su-
et su
.su-
et su
.SourceWiki anglophone, su a écrit :it is advisable that administrative users, as well as any other users that are authorized to use su (and it is suggested that there be very few, if any) acquire the habit of always following the su command with a space and then a hyphen. The hyphen has two effects:
1. switches from the current directory to the home directory of the new user (e.g., to /root in the case of the root user) by logging in as that user
2. changes the environmental variables to those of the new user as dictated by their ~/.bashrc. That is, if the first argument to su is a hyphen, the current directory and environment will be changed to what would be expected if the new user had actually logged on to a new session (rather than just taking over an existing session).
Code : Tout sélectionner
$ echo $LOGNAME
oktoberfest
$ su
Mot de passe :
# echo $LOGNAME
oktoberfest
# exit
$ su -
Mot de passe :
# echo $LOGNAME
root
Certaines variables d'environnement : surtout, tu n'es alors pas dans un environnement root complet.oktoberfest a écrit : Ceci peut amener comme désagréments (il suffit de lire quelques messages sur le forum) d'avoir des fichiers qui appartiennent à root dans ton répertoire utilisateur -> Et ensuite on se plaint que des programmes ne marchent pas correctement
wiki anglophone, F.A.Q. a écrit :Before asking for help, do your own independent research by Googling, searching the forum (and reading the rest of these FAQs) and searching the superb documentation provided by the Arch Wiki. There is a reason these resources were made available to you in the first place. Many thousands of volunteered hours have been spent compiling this excellent information.