Technical text
Users and permissions in GNU/Linux
An explanation of users, permissions, and console conventions.
Author: Paynalton
Published: 2009
Reading preferences
This is something that many new users find confusing…
Many times they will see manuals and messages that look like this:
Code:
$ls todo
#apt-get install miprograma
And they don’t take into account the first character.
Linux
is a pretty secure system because most things are done in
user mode, so what we do in this mode will never damage
the system (unless we have done very stupid things before,
such as changing permissions on important files and
directories).
When in a manual or instruction we indicate that
a command should be used in user mode, we use the character “$” at the
beginning of the line, for example:
Code:
$mkdir nuevacarpeta
$rm archivodeprueva
$ls *
In contrast, when we need to run a command as administrator, we indicate it with the character “#”, for example:
Code:
#apt-get install loquesea
#nano /etc/archivo.conf
#rm -r /*
Recommendations:
For
the safety of their equipment, when they go to run a command as
administrator, start the session, execute what they need to execute,
and return immediately to user mode, this will save them from making an
error that could be fatal to the system.
Switching between user mode and Administrator:
In Linux there will always be more than one way to do things.
The
most common option to run a command is to open a virtual console (some
program within the graphical environment that shows us the command line in
the purest MS-DOS style). and execute commands. When opening it, we will
see something like:
Code:
paynalton@Carlos-Internet:~$
As
you can see, the “$” indicates that we are in user mode. To be more
specific, the PROMPT is structured as follows:
Code:
paynalton @ Carlos-Internet : ~ $
NombreDelUsuario @ NombreDelEquipo : DirectorioActual MODO
To switch to administrator mode we use the command “su”
Code:
paynalton@intraasm:~$ su
Password:
intraasm:/var/www/nuevaintra#
As
ven changes the final character to a “#” indicating that we are in
administrator mode, to return to the previous mode simply use the
command “exit”
Code:
paynalton@intraasm:~$ su
Password:
intraasm:/var/www/nuevaintra# exit
exit
paynalton@intraasm:~$
Thus, you will always return to the previous user.
Some
systems, for security reasons, do not allow you to use the “su” command (Ubuntu
and all its derivatives), but instead come with another quite useful and secure
command: “sudo” (stand in for superuser). This command will allow you to
execute commands as if you were the administrator, but without fully opening the
session, so that you do not need to use the “exit” command.
Therefore, if in a manual you see something like:
Code:
$./config
$./make
#./make install
it is the same as if you execute:
Code:
paynalton@intraasm:~$./config
paynalton@intraasm:~$./make
paynalton@intraasm:~$su
Password:
intraasm:/var/www/nuevaintra#./make install
intraasm:/var/www/nuevaintra# exit
exit
paynalton@intraasm:~$
and
Code:
paynalton@Carlos-Internet:~$./config
paynalton@Carlos-Internet:~$./make
paynalton@Carlos-Internet:~$ sudo ./make install
[sudo] password for paynalton:
paynalton@Carlos-Internet:~$
And I think that’s all for this brief clarification, I hope it is useful to you.
If you wish to know more about the commands mentioned here, do not forget to check the manuals by typing in your console:
Code:
$man comando