{"id":359,"date":"2019-10-21T19:57:42","date_gmt":"2019-10-21T17:57:42","guid":{"rendered":"http:\/\/linuxboxen2.dk\/?p=359"},"modified":"2019-10-21T19:57:42","modified_gmt":"2019-10-21T17:57:42","slug":"org_su","status":"publish","type":"post","link":"https:\/\/www.linuxboxen.dk\/?p=359","title":{"rendered":"SU"},"content":{"rendered":"<p>SU(1)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 User Commands\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SU(1)<\/p>\n<p>NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>su &#8211; run a command with substitute user and group ID<\/p>\n<p>SYNOPSIS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>su [options] [-] [user [argument&#8230;]]<\/p>\n<p>DESCRIPTION\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>su allows to run commands with a substitute user and group ID.<\/p>\n<p>When called without arguments, su defaults to running an interactive<br \/>\nshell as root.<\/p>\n<p>For backward compatibility, su defaults to not change the current<br \/>\ndirectory and to only set the environment variables HOME and SHELL<br \/>\n(plus USER and LOGNAME if the target user is not root).\u00a0 It is<br \/>\nrecommended to always use the &#8211;login option (instead of its shortcut<br \/>\n-) to avoid side effects caused by mixing environments.<\/p>\n<p>This version of su uses PAM for authentication, account and session<br \/>\nmanagement.\u00a0 Some configuration options found in other su<br \/>\nimplementations, such as support for a wheel group, have to be<br \/>\nconfigured via PAM.<\/p>\n<p>OPTIONS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>-c, &#8211;command=command<br \/>\nPass command to the shell with the -c option.<\/p>\n<p>-f, &#8211;fast<br \/>\nPass -f to the shell, which may or may not be useful,<br \/>\ndepending on the shell.<\/p>\n<p>-g, &#8211;group=group<br \/>\nSpecify the primary group.\u00a0 This option is available to the<br \/>\nroot user only.<\/p>\n<p>-G, &#8211;supp-group=group<br \/>\nSpecify a supplemental group.\u00a0 This option is available to the<br \/>\nroot user only.<\/p>\n<p>-, -l, &#8211;login<br \/>\nStart the shell as a login shell with an environment similar<br \/>\nto a real login:<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 clears all the environment variables except TERM<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 initializes the environment variables HOME, SHELL,<br \/>\nUSER, LOGNAME, and PATH<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 changes to the target user&#8217;s home directory<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 sets argv[0] of the shell to &#8216;-&#8216; in order to make<br \/>\nthe shell a login shell<\/p>\n<p>-m, -p, &#8211;preserve-environment<br \/>\nPreserve the entire environment, i.e. it does not set HOME,<br \/>\nSHELL, USER nor LOGNAME.\u00a0 This option is ignored if the option<br \/>\n&#8211;login is specified.<\/p>\n<p>-s, &#8211;shell=shell<br \/>\nRun the specified shell instead of the default.\u00a0 The shell to<br \/>\nrun is selected according to the following rules, in order:<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 the shell specified with &#8211;shell<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 the shell specified in the environment variable<br \/>\nSHELL, if the &#8211;preserve-environment option is used<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 the shell listed in the passwd entry of the target<br \/>\nuser<\/p>\n<p>o\u00a0\u00a0\u00a0\u00a0\u00a0 \/bin\/sh<\/p>\n<p>If the target user has a restricted shell (i.e. not listed in<br \/>\n\/etc\/shells), the &#8211;shell option and the SHELL environment<br \/>\nvariables are ignored unless the calling user is root.<\/p>\n<p>&#8211;session-command=command<br \/>\nSame as -c but do not create a new session.\u00a0 (Discouraged.)<\/p>\n<p>-V, &#8211;version<br \/>\nDisplay version information and exit.<\/p>\n<p>-h, &#8211;help<br \/>\nDisplay help text and exit.<\/p>\n<p>SIGNALS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>Upon receiving either SIGINT, SIGQUIT or SIGTERM, su terminates its<br \/>\nchild and afterwards terminates itself with the received signal.<\/p>\n<p>CONFIG FILES\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>su reads the \/etc\/default\/su and \/etc\/login.defs configuration files.<br \/>\nThe following configuration items are relevant for su(1):<\/p>\n<p>FAIL_DELAY (number)<br \/>\nDelay in seconds in case of an authentication failure. The number<br \/>\nmust be a non-negative integer.<\/p>\n<p>ENV_PATH (string)<br \/>\nDefines the PATH environment variable for a regular user.\u00a0 The<br \/>\ndefault value is \/usr\/local\/bin:\/bin:\/usr\/bin.<\/p>\n<p>ENV_ROOTPATH (string)<br \/>\nENV_SUPATH (string)<br \/>\nDefines the PATH environment variable for root.\u00a0 The default<br \/>\nvalue is \/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:<br \/>\n\/usr\/bin.<\/p>\n<p>ALWAYS_SET_PATH (boolean)<br \/>\nIf set to yes and &#8211;login and &#8211;preserve-environment were not<br \/>\nspecified su initializes PATH.<\/p>\n<p>EXIT STATUS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>su normally returns the exit status of the command it executed.\u00a0 If<br \/>\nthe command was killed by a signal, su returns the number of the<br \/>\nsignal plus 128.<\/p>\n<p>Exit status generated by su itself:<\/p>\n<p>1\u00a0\u00a0\u00a0\u00a0\u00a0 Generic error before executing the requested command<\/p>\n<p>126\u00a0\u00a0\u00a0 The requested command could not be executed<\/p>\n<p>127\u00a0\u00a0\u00a0 The requested command was not found<\/p>\n<p>FILES\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>\/etc\/pam.d\/su\u00a0\u00a0\u00a0 default PAM configuration file<br \/>\n\/etc\/pam.d\/su-l\u00a0 PAM configuration file if &#8211;login is specified<br \/>\n\/etc\/default\/su\u00a0 command specific logindef config file<br \/>\n\/etc\/login.defs\u00a0 global logindef config file<\/p>\n<p>NOTES\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>For security reasons su always logs failed log-in attempts to the<br \/>\nbtmp file, but it does not write to the lastlog file at all.\u00a0 This<br \/>\nsolution allows to control su behavior by PAM configuration.\u00a0 If you<br \/>\nwant to use the pam_lastlog module to print warning message about<br \/>\nfailed log-in attempts then the pam_lastlog has to be configured to<br \/>\nupdate the lastlog file as well. For example by:<\/p>\n<p>session\u00a0 required\u00a0 pam_lastlog.so nowtmp<\/p>\n<p>SEE ALSO\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>runuser(8), pam(8), shells(5), login.defs(5)<\/p>\n<p>HISTORY\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>This su command was derived from coreutils&#8217; su, which was based on an<br \/>\nimplementation by David MacKenzie.<\/p>\n<p>AVAILABILITY\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>The su command is part of the util-linux package and is available<br \/>\nfrom Linux Kernel Archive<br \/>\n\u27e8ftp:\/\/ftp.kernel.org\/pub\/linux\/utils\/util-linux\/\u27e9.<\/p>\n<p>COLOPHON\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>This page is part of the util-linux (a random collection of Linux<br \/>\nutilities) project.\u00a0 Information about the project can be found at<br \/>\n\u27e8https:\/\/www.kernel.org\/pub\/linux\/utils\/util-linux\/\u27e9.\u00a0 If you have a<br \/>\nbug report for this manual page, send it to<br \/>\nutil-linux@vger.kernel.org.\u00a0 This page was obtained from the<br \/>\nproject&#8217;s upstream Git repository<br \/>\n(git:\/\/git.kernel.org\/pub\/scm\/utils\/util-linux\/util-linux.git) on<br \/>\n2014-12-30.\u00a0 If you discover any rendering problems in this HTML ver\u2010<br \/>\nsion of the page, or you believe there is a better or more up-to-date<br \/>\nsource for the page, or you have corrections or improvements to the<br \/>\ninformation in this COLOPHON (which is not part of the original man\u2010<br \/>\nual page), send a mail to\u00a0man-pages@man7.org<\/p>\n<p>util-linux\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 July 2014\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SU(1)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SU(1)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 User Commands\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SU(1) NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top su &#8211; run a command with substitute user and group ID SYNOPSIS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top su [options] [-] [user [argument&#8230;]] DESCRIPTION\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top su allows to run commands with a substitute user and group ID. When called without arguments, su defaults to running an interactive shell as root. For backward compatibility, su [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-359","post","type-post","status-publish","format-standard","hentry","category-shell"],"a3_pvc":{"activated":false,"total_views":0,"today_views":0},"_links":{"self":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=359"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/359\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}