Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2002 15:36:42 +0100
From:      "Barry Byrne" <barry.byrne@wbtsystems.com>
To:        "Rob Ellis" <rob@web.ca>, <freebsd-questions@FreeBSD.ORG>
Subject:   RE: Run a command as another user
Message-ID:  <NCBBIAMNAKDKFJIIGNPKCEMOJEAA.barry.byrne@wbtsystems.com>
In-Reply-To: <20020819141452.GB30342@web.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
The su man page is a bit confusing. Actually, the -c option has two uses.
If the -c appears after a specified login user, it means 'run command':

e.g.   su barney -c 'touch /tmp/test1"

means run 'touch /tmp/test1' as user 'barney'

If the -c option appears prior to a specified login user, it means run
under resource restrictions of specifed class:

e.g.  su -c staff barney -c '/usr/local/bin/touchjob arg1'

means run '/usr/local/bin/touchjob arg1' as user barney, with resources of
login class 'staff'.

Cheers,

Barry

--
Barry Byrne, IT Manager,
WBT Systems, Block 2, Harcourt Centre
Harcourt Street, Dublin 2, Ireland


> -----Original Message-----
> From: owner-freebsd-questions@FreeBSD.ORG
> [mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of Rob Ellis
> Sent: 19 August 2002 15:15
> To: freebsd-questions@FreeBSD.ORG
> Subject: Re: Run a command as another user
>
>
> >     # su anotheruser -c program
> >
> >     btw, the man page (at least on two of my STABLE systems) lies:
> >     the -c switch allows one to specify a command, not login class
>
> the -c in 'su username -c command' is an option passed to sh...
>
>     su [-Kflm] [-c class] [login [args]]
>
> it's one of the 'args', a different -c.
>
> - rob
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NCBBIAMNAKDKFJIIGNPKCEMOJEAA.barry.byrne>