CSE 391
Users, Groups, Permissions
Slides created by Josh Ervin and Hunter Schafer. �Based off slides made by Marty Stepp, Jessica Miller, Ruth Anderson, Brett Wortzman, and Zorah Fung
Users
Users - Commands
Command | Description |
whoami | Print your username |
id | Print user ID and group membership |
users | List logged-in users (short) |
who | List logged-in users (long) |
pinky | Print information about users |
Groups
Groups - Commands
To add users to a group, you must edit /etc/group as root. We will talk more about the root user later in these slides.
Command | Description |
groups | Print group membership |
groupadd | Create a group |
groupdel | Delete a group |
groupmod | Modify a group |
root
Processes
Command | Description |
ps | List processes being run |
ps -u <user> | List processes being run by <user> |
top | Show process statistics |
kill | Terminate process by PID |
killall | Terminate process by name |
Aliases
alias name=command
alias q=exit
�WARNING: DO NOT PUT SPACES ON EITHER SIDE OF THE =
.bash_profile
.bashrc
$PATH
execute(command)
for each entry in $PATH separated by “:”
if directory contains command
run command
exit
print “command not found”
$PATH
/usr/bin/hello.sh
echo “howdy partner”
Suppose we have the following executable files and $PATH variable
PATH=/usr/home:/usr/bin:/usr/sbin
What would be the output of the following command?
> hello.sh
/usr/sbin/hello.sh
echo “yeehaw”
Changing File Group
File Permissions
Since multiple users share the same system, files and directories are protected by certain permissions.
Permissions are shown by typing ls -l
is it a directory
owner(u)
group(g)
others(o)
d rwx rwx rwx
File Permissions
Changing File Permissions
NOTE: THERE IS NO SPACE AFTER THE COMMA
Changing File Permissions
Using letter codes, (i.e. rwx) what would be the command to allow the owner and group to read, write, and execute and others to read the file run.sh?
u | owner |
g | group |
o | other |
r | read |
w | write |
x | execute |
Using octal codes (i.e. 0-7), what would be the command to allow the owner and group to read, write, and execute and others to read the file run.sh?
1 | execute |
2 | write |
4 | read |
Default File Permissions
Directory Permissions