![]() sudo allows any command to be run as a trailing parameter, not just the user's shell.The major differences between su and sudo are as follows: ![]() This effectively allows the ownership of a single command to be changed without disrupting the rest of the session to assume the role of the new user. The sudo command permits users to execute commands as other users as allowed by a sudo specific security policy. This command is the original and the simplest of the three, but you still may want to read the man page for su for additional information. SYSLOG uses syslog to log all su attempts.SUPATH sets the default path of a superuser shell spawned by su.PATH sets the default path of a shell spawned by su.CONSOLE if defined, all attempts to su to the superuser are logged to the console.SULOG all attempts to use su are logged to the specified file.Sets the MAIL environment variable to /var/mail/new_user.Īny parameters after the user will be passed to the executing shell, effectively emulating sudo's general functionality: # su - brian -c whoamiĪdditionally, the behavior of su can be modified by altering configuration parameters in /etc/default/su, specifically the following:.The LC*, LANG and TZ environment variables from the specified user's environment are also propagated to the new shell.The - parameter before the username further configures the login environment with the following additional changes: Superusers are never prompted for login credentials when using su. Non-superusers attempting to switch users will be prompted for the login credentials of the user being switched to, just as they might be if they were logging in directly from a terminal. This effectively allows the ownership of a session to be changed without logging off to assume the role of the new user. The switch user ( su) command executes a new shell owned by the specified user (or root if no user is specified). Today we will be exploring the command-line methods available on SmartOS for executing commands as other users, namely su and sudo. Clearly, this can be done by directly starting a session as a given user, or even logging in again through localhost, but this approach tends to break down when manipulating system users (which are never meant to be directly logged into) or performing complex cross-user automation. For as long as there have been multi-user operating systems, there has been the need to switch between those users.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |