A historical curiosity in su(1)

Glen Barber gjb at FreeBSD.org
Wed Mar 22 04:13:11 UTC 2017


On Tue, Mar 21, 2017 at 04:12:23PM -0700, Rodney W. Grimes wrote:
> > Jumping back to the point I made in the talk, the result of getlogin can often
> > be surprising. For example, a daemon restarted by a supervisor (e.g. upstart)
> > will be associated with the user that issued the restart (i.e. getlogin would
> > return "chris" if I restarted it, rather than something like "daemon-user"). Any
> > daemon that calls su will run into this behaviour.
> 
> su - should resolve that behavior.
> 

For clarification with special characters, this is 'su -', which indeed
does resolve the behavior described.  From the su(1) manual page:

     su -l foo
            Simulate a login for user foo.
     su - foo
            Same as above.
     su -   Simulate a login for root.

Glen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20170322/46fee30c/attachment.sig>


More information about the freebsd-hackers mailing list