Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
su(1M)									su(1M)

       su - become super-user or another user

       su [ - ]	[ username [ arg ... ] ]


       su  allows one to become	another	user without logging off.  The default
       user name is root (super-user).

       To use su, the appropriate password must	be supplied  (unless  the  in-
       voker  is  already root).  If the password is correct, su creates a new
       shell process that has the real and effective user ID, group  IDs,  and
       supplementary  group  list set to those of the specified	username.  The
       new shell will be the shell specified in	the shell field	of  username's
       password	 file  entry  (see  passwd(4)).	  If  no  shell	 is specified,
       /usr/bin/sh is used (see	sh(1)).	 To return to normal  user  ID	privi-
       leges, type an EOF character (CTRL-D) to	exit the new shell.

       Any  additional	arguments  given on the	command	line are passed	to the
       new shell.  When	using programs such as sh,  an	arg  of	 the  form  -c
       string  executes	string using the shell and an arg of -r	gives the user
       a restricted shell.

       If the first argument to	su is `	- ' (dash), the	 environment  will  be
       changed to what would be	expected if the	user actually logged in	as the
       specified user.	This is	accomplished by	invoking the program  used  as
       the  shell with a first argument	value whose initial character is ` - '
       (dash), thus simulating a login.	 If the	first argument to su is	not  `
       -  ' (dash), the	environment is passed along unchanged, with the	excep-
       tion of $PATH, which is controlled  by  PATH  and  SUPATH  in  /etc/de-

       All attempts to become another user using su are	logged in the log file
       /var/adm/sulog (see sulog(4)).

       To become user bin while	retaining your	previously  exported  environ-
       ment, execute:
	      example% su bin

       To become user bin but change the environment to	what would be expected
       if bin had originally logged in,	execute:
	      example% su - bin

       To execute command with the temporary environment  and  permissions  of
       user bin, type:
	      example% su - bin	-c "command args"

       If  any of the LC_* variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COL-
       LATE, LC_NUMERIC, and LC_MONETARY ) (see	environ(5)) are	not set	in the
       environment,  the operational behavior of su for	each corresponding lo-
       cale category is	determined by the value	of the LANG environment	 vari-
       able.   If  LC_ALL  is  set, its	contents are used to override both the
       LANG and	the other LC_* variables.  If none of the above	variables  are
       set  in the environment,	the "C"	 (U.S. style) locale determines	how su

       LC_CTYPE	      Determines how su	handles	characters. When  LC_CTYPE  is
		      set to a valid value, su can display and handle text and
		      filenames	containing valid characters for	 that  locale.
		      su can display and handle	Extended Unix Code (EUC) char-
		      acters where any individual character can	be 1, 2, or  3
		      bytes  wide.  su can also	handle EUC characters of 1, 2,
		      or more column widths. In	the "C"	locale,	 only  charac-
		      ters from	ISO 8859-1 are valid.

       LC_MESSAGES    Determines  how  diagnostic and informative messages are
		      presented. This includes the language and	style  of  the
		      messages,	 and the correct form of affirmative and nega-
		      tive responses.  In the "C"  locale,  the	 messages  are
		      presented	 in  the default form found in the program it-
		      self (in most cases, U.S.	English).

       $HOME/.profile	   user's login	commands for sh	and ksh
       /etc/passwd	   system's password file
       /etc/profile	   system-wide sh and ksh login	commands
       /var/adm/sulog	   log file
       /etc/default/su	   the default parameters that reside here are:
			   SULOG:	  If defined, all attempts  to	su  to
					  another user are logged in the indi-
					  cated	file.
			   CONSOLE:	  If defined, all attempts  to	su  to
					  root are logged on the console.
			   PATH:	  Default path.	(/usr/bin:)
			   SUPATH:	  Default  path	for a user invoking su
					  to root.  (/usr/sbin:/usr/bin)
			   SYSLOG:	  Determines  whether  the   syslog(3)
					  LOG_AUTH  facility should be used to
					  log  all  su	attempts.   LOG_NOTICE
					  messages  are	 generated for su's to
					  root,	LOG_INFO messages  are	gener-
					  ated	for  su's  to other users, and
					  LOG_CRIT messages are	generated  for
					  failed su attempts.

       csh(1),	 env(1),  ksh(1),  login(1),  sh(1),  syslogd(1M),  syslog(3),
       passwd(4), profile(4), sulog(4),	environ(5)

				  14 Sep 1992				su(1M)


Want to link to this manual page? Use this URL:

home | help