04 Flashcards

1
Q

What are the two types of shell variable? what’s the difference between them?

A

Local: variables can only be executed in the shell that you are in

environmental variables are made global and can be executed in children shells of that parent process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What command displays existing shell variables, Enviromental variables, and shell functions?

what command shows only environmental variables?

A

set

env

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s the syntax for creating a variable/command variable?

A

Hello=Greeeting
machine=$(uname)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What command makes a variable globally accessible?

A

export

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Whihc of these are user specific, and which are system wide?

~/.bash_profile
~/.bashrc
/etc/bash_profile
/etc/bashrc

A

user
user
public
public

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Whist command and syntax lets me save changes and make them appear now instead of rebooting/logging off? To the
bash_profile or bash_rc?

A

source ~./bash_profile
source /etc/bash_profile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What must be at the beginning of a bash shell script?

What must be at the beginning of a PowerShell script

How do you run a script?

A

!/bin/bash

bash ./scriptname.sh
if your in directory ./scriptname.sh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What’s the difference between a login shell and a non-login shell?

What command tells me whether im in a login shell or not?

A

One is a remote login using telnet or ssh, the other dosen’t require a login at all

echo $0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What file shows me a history of all entered commands?

and how do I access it?

A

~/.bash_history

echo $histfile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A ______________ restricts the activities of users on a shell

A

restricted shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of these are used for authentication/authorization or both?

/etc/shadow
/etc/passwd
/etc/group

A

authentication
authentication and authorization
authorization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What file contains general user information and what are it’s fields?

A

/etc/passwd u passed up good chicks doing shots

Username
placeholder for hashed Password
UID
GID
Comment (what they see on the login screen)
Home Directory
Default shell /bin/bash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What file contains all the users password information and its fields?

A

/etc/shadow U Have lost many matches, winning is everything

Username
Hashed password
Last pswd change
Minimum password length
maximum password length
Warning
inactive
expiration date

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What file contains all the group information? And what are its fields?

A

/etc/group good pussy gets soupy

Group name
Password
Group ID
Supplementary members

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Within /etc/passwd how can I tell if an account has never logged in or is disabled?

How can I lock or unlock an account?

A

in the hashed password field there if these is a !! then that account has never logged on

passwd -l jim
passwd -u jim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can I tell what encryption method the hash password is using?

A

more /etc/login.defs

17
Q

What command lets me add or delete a group?

What command add a file too a group?

A

groupadd 432(gid) bobbys
groupdel bobbys

newgrp bobbys
touch text.txt
exit

18
Q

how do I add a user joe too decepticons as his primary group and autobots as his supplemntary group??

How do I edit his deffault shell?

How do I create the user bumblee with a home directory, autobots being his primary group, decepticons being his supplementary, his login page displaying “bee” and he has a bash shell?

A

usermod -g decpeticons -G autobots joe

usermod -s /bin/bash joe

useradd -d /home/bumblebee -m -g autobots -G decepticons -c bee -s /bin/bash

19
Q

how do I display the password age information of a user?

A

chage joe

20
Q
A