Discussion:
sudo TTY Unknown messages
Robin Becker
2005-12-29 14:22:35 UTC
Permalink
I am getting messages from sudo concerning an unknown TTY.

eg

Dec 29 02:30:40 www sudo: root : TTY=unknown ; PWD=/usr/tmp/BU/svn_backups ;
USER=www ; COMMAND=/usr/local/bin/svnadmin dump -q -r0:19591 /svn/private

I think this is caused by not having a tty device in the root cron job. I would
prefer to keep only one main cron job for my system or is that frowned upon.
--
Robin Becker
Robin Becker
2005-12-29 15:18:04 UTC
Permalink
Post by Robin Becker
I am getting messages from sudo concerning an unknown TTY.
eg
Dec 29 02:30:40 www sudo: root : TTY=unknown ;
PWD=/usr/tmp/BU/svn_backups ; USER=www ; COMMAND=/usr/local/bin/svnadmin
dump -q -r0:19591 /svn/private
I think this is caused by not having a tty device in the root cron job.
I would prefer to keep only one main cron job for my system or is that
frowned upon.
I'm being daft; it seems sudo always logs itself. Is there away to get sudo to
not syslog if it's root sudoing as www? I looked at sudoers, but couldn't see an
obvious way to set !syslog for

root > www using svnadmin or svnlook etc etc
--
Robin Becker
Matthew Seaman
2005-12-29 15:58:53 UTC
Permalink
Post by Robin Becker
I'm being daft; it seems sudo always logs itself. Is there away to get
sudo to not syslog if it's root sudoing as www? I looked at sudoers, but
couldn't see an obvious way to set !syslog for
root > www using svnadmin or svnlook etc etc
Well, if you're starting as root, you can just use:

su user -c 'some command line'

to run a command as whatever user you want -- no password required. su will log to /var/log/auth.log but it's nowhere near as verbose as sudo.

Or you can use /etc/crontab which has an extra field specifying which UID
a command should be run as, unlike the normal per-user crontab files. Usual
advice is to leave /etc/crontab alone and put your local cron jobs into the
per-user crontab files. However the system crontab file /can/ be customised
if you really want to -- you'll just have to merge any changes when you do system
updates and so forth.

But on the whole, the best and cleanest solution to running cron jobs as some
arbitrary user is to create a crontab file for that user.

Cheers,

Matthew
--
Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard
Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
Kent, CT11 9PW
Loading...