Date: Mon, 02 Jan 2006 00:42:24 -0800 From: Scott Smith <scott@lackluster.net> To: Mike Esquardez <mikeala3@hotmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: Help with Difficult Startup Script Message-ID: <43B8E770.5090300@lackluster.net> In-Reply-To: <BAY7-F35C810ADD4E6EF7A915B29A2D0@phx.gbl> References: <BAY7-F35C810ADD4E6EF7A915B29A2D0@phx.gbl>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 su user -c command 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'm not sure if what you're doing is the best way to go about things though... Also, I would be very careful with running scripts as root that are not owned by root. If the user mik owns the script, and that account is compromised, they have a very easy path to root access. Scott Mike Esquardez wrote: > Hello, I am trying to make a script that runs the following commands. > This is difficult for me because I dont know how to switch users. > Currently these are the commands that I am trying to script. > > # fetchmail ?d 1000 & (this needs to be run as username mik) > # su -l root > # /home/mik/myfilter & (this needs to be run as root) > > I know I have to make the files executable and .sh extension then put > them in /usr/local/etc/rc.d to get them to run at startup but I am not > sure how to make these commands run as different users. > > Is there a way to have something like this? (i know runas isnt a real > shell command) > > #/bin/sh > runas "mik" fetchmail & > runas "root" /home/mik/myfilter & > > Any help would be very much helpful. mik > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" - -- scott@lackluster.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) iD8DBQFDuOdwKBeC2yZ3EEsRArnzAKCJJ/pvathcwgJdBAbfIjJcktfXwACdGj14 Pm/TpuOrHJ5c4yx5eSnvxSI= =KyLU -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43B8E770.5090300>