Lab#4

Lab 4 Description

In this lab we will test the following commands: chmod, su, sudo, chown, passwd, ps, kill, and printenv.

Command chmod:

The following command allows for the user to change a file or directory permissions which are read, write and execute. In the following case the file testing.txt original has the permissions to read and write for owner and read for both group and everyone. Using the chmod command to octal 600 we have the file now only readable and writable by the owner. Following that we change it to where anyone can read, write and execute the file by changing the mode to 777.

chmod

Command su:

The following command allows for another user to log in. In the following case we change the user to keven and then enter the password to gain access. In the next case we just enter su and followed by a password and receive a authentication failure because of the password being wrong.

su

Command sudo:

The following command allows for a different user to execute commands. This is called a superuser. In the following case sudo -l is used to see what commands the current user can execute and which one’s they can not followed by checking of the version history.

sudo

Command chown:

The following command allows for the user to change the ownership of a file to another. In the following case since there is only one user we check to see who has ownership over the file input_file.txt.

chown

Command passwd:

The following command allows for changing of the password for the user. In the following case if were to change the password for the only user we enter passwd and then type the password. One thing to note though is that you not physically see your password entered on the terminal.

passwd

Command ps:

The following command provides a screenshot of currently running processes. In the following case we use ps x which when used with x lists the running processes without the associated terminal.

ps

Command kill:

The following command used to kill running process. In the following case we have three different process running that displays a x logo on the screen. To terminate these three process we use killall xlogo to terminate the three xlogo processes which cases them to not be on the screen anymore.

kill

Command printenv:

The following command prints the values of environmental variables. In the following case we show who the user is. Following this we use grep with the command to print things that are associated with the variable name such as the username, folder directory, password, and more.

printenv

Leave a Reply

Your email address will not be published. Required fields are marked *