1842531 Members
2856 Online
110189 Solutions
New Discussion

Re: at command

 
IRI Unix Support Team
Occasional Contributor

at command

Is there a way to disable at command mailing feature for non root user?
3 REPLIES 3
Brian M Rawlings
Honored Contributor

Re: at command

One way would be to disable non-root access to 'at', but give them access to a script named 'at', which calls the real 'at', with whatever options you allow/provide.

Without the source for 'at', and unsupported fiddling at the program level, I don't know of any way to restrict access to some functions of a command. It is easy to restrict or allow access to commands, but, below that level of control, the method I described above may be your only bet.

Maybe somebody else will have a better idea...?

Regards, --bmr
We must indeed all hang together, or, most assuredly, we shall all hang separately. (Benjamin Franklin)
John Palmer
Honored Contributor

Re: at command

As with any other cron issued job, anything sent to standard output or standard error will be sent as a mail to the relevant user.

The way to stop it is to ensure that all output is sent to either an alternative log file or /dev/null.

If it's a simple command you can do something like:-

at ...
command > yourfile 2>&1
ctrl D

yourfile could be /dev/null.

Alternatively, you can use exec to redirect standard output and standard error:-

at ...
exec 1>yourfile 2>&1
commands
...
ctrl D

Regards,
John
Shannon Petry
Honored Contributor

Re: at command

NO, not in the normal sense anyway.

Why? at and cron are just job wrappers. While they email the output of the job, the output is not from cron, but the commands/script a user schedules with at/cron.

In crontab, we can bypass mail features by re-directing output. The same with at.

Unless you want to replace at with a wrapper (which could be a nightmare depending on what your users are scheduling), just have them append their jobs output to /dev/null.

Regards,
Shannon
Microsoft. When do you want a virus today?