Re: su within script question

From: Vwakes (
Date: 09/04/03

Date: Wed, 3 Sep 2003 19:27:58 -0700

On Wed, 3 Sep 2003 Pamela Bratcher wrote:

>In my startup script, I want to su to another user (that doesn't have a
>password) and then run a command as that user.

If you are root then you don't need the password anyways. This is what I
have in my rc.local script:

su news -c "/usr/local/sbin/fetchnews -v &"

The & just makes it run in the background.

>How can I do this?

man su


Relevant Pages

  • [SLE] Fwd: [COLUG] Command Not Found
    ... bandwith. ... >command not found error message. ... I know that running as root is a security hole.) ... >It works if I run the script as a user. ...
  • RE: [Perl-beginners] Perl script to switch user to root.
    ... perhaps you should let the script do something like SUDO, ... Perl script to switch user to root. ... I know I can run the "su root" with the system command ...
  • Re: /proc/NNNNN accuracy
    ... a short script that read /proc and formatted the info allowed me to ... Only root can change that, ... >> I realize a running program could change its command line etc. ... the pid and uid will be correct the moment you read it. ...
  • Re: Help with Difficult Startup Script
    ... If you are running it as an rc script, you'll probably want to use su ... for the fetchmail command, since init scripts run as root anyway. ... I would be very careful with running scripts as root that are not ... If the user mik owns the script, ...
  • Re: Tracking changes to the UNIX PATH
    ... > I'm looking for something to watch changes to the UNIX path. ... Later root adds it to /usr/bin or suchlike. ... I then have a script which does a compare the reference copy ... gives me the command to see the difference. ...