Posts

Permissions

Permissions determine the ways different users can interact with a file or directory. When listing a file with the  ls -l  command, the output includes permission information. For the example we will use a script called  hello.sh  located in the  Documents  directory: Follow Along Use the following command to switch to the  Documents  directory: sysadmin@localhost : ~ $ cd ~/Documents sysadmin@localhost : ~/Documents $ ls -l hello.sh -rw-rw-r-- 1 sysadmin sysadmin 21 Aug 1 02:35 hello.sh Below is a review of the fields relevant to permissions. File Type Field - rw-rw-r-- 1 sysadmin sysadmin 21 Aug 1 02:35 hello.sh The first character of this output indicates the type of a file. Recall if the first character is a  -  this is a regular file. If the character was a  d , it would be a directory. Permissions Field - rw-rw-r-- 1 sysadmin sysadmin 21 Aug 1 02:35 hello.sh After t...

Administrative Access

There are many Linux commands which deal with sensitive information like passwords, system hardware, or otherwise operate under other exceptional circumstances. Preventing regular users from executing these commands helps to protect the system. Logging in as the root user provides administrative access, allowing for the execution of some of the privileged commands. The  su  Command su OPTIONS USERNAME The  su  command allows you to temporarily act as a different user. It does this by creating a new shell. By default, if a user account is not specified, the  su command will open a new shell as the root user, which provides administrative privileges. Follow Along Utilizing the login shell option is recommended, as the login shell fully configures the new shell with the settings of the new user. This option can be specified one of three ways: su - su -l su --login Use the   su   command to switch to the root account Use the  exit ...

Listing Files

The  ls  command is used to list the contents of a directory. You've already seen it used a few times before in examples, but this page will help ensure you are comfortable with its use. ls [ OPTIONS ] [ FILE ] By default, when the  ls  command is used with no options or arguments, it will list the files in the current directory: sysadmin@localhost : ~ $ ls Desktop Documents Downloads Music Pictures Public Templates Videos To learn the details about a file, such as the type of file, the permissions, ownerships or the timestamp, perform a long listing using the  -l  option to the  ls  command. Below, a listing of the  /var/log  directory is used as an example, since it provides a variety of output: ​⁠​‌‌⁠⁠⁠⁠​ sysadmin@localhost : ~ $ ls -l /var/log/ total 832 -rw-r--r-- 1 root root 17869 Mar 14 17:48 alternatives.log drwxr-x--- 2 root adm 4096 Mar 14 17:48 apache2 drwxr-xr-x 2 root root 4096 Mar 14 1...

Changing Directories

Image
Files are used to store data such as text, graphics and programs. Directories are a type of file used to store other files, they provide a hierarchical organization structure. The image below shows an abbreviated version of the filesystem structure on the virtual machines. When you start a fresh virtual machine, either by opening the course or after using the reset button, you are logged in as the  sysadmin  user in your home directory, highlighted below: To navigate the filesystem structure, use the  cd (change directory) command to change directories. cd [options] [path] ​⁠​‌‌⁠⁠⁠⁠​ If you look back at the graphic above, you will see the  Documents  directory is located within the  home directory, where you are currently located. To move to the  Documents  directory, use it as argument to the  cd  command: sysadmin@localhost : ~ $ cd Documents sysadmin@localhost : ~/Documents...