Cron Job for Fake User


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron Job for Fake User
# 1  
Old 09-28-2014
Cron Job for Fake User

There is a program that we (a company I'm working for) would like to run once per day, and the approach we're taking is to create a fake user to give a location to the data for this program, and to be the user running the program. For the sake of the discussion, let me call the fake user "bob".

Since there is no actual person called bob, there is no reason to allow anyone to login as bob. If someone needs to do something to bob's data or programs, then they can su to bob.

Here's the problem: When I create a crontab for bob, it doesn't seem to run. Is there some reason that disabling logins would effect the ability to run crontab?

Here's a clue, perhaps. When I try to su to bob using

sudo su bob

I get the error message:
>Your account has expired; please contact your system administrator
>su: Authentication failure
>(Ignored)

But afterwards, whoami says that I am now bob. So I don't understand what that failure message means.

Thanks
Daryl
# 2  
Old 09-28-2014
You did not say what OS you are running... and disabling an account is not the same as nologin
Nologin is used by some OS e.g. for FTP accounts, you cannot log in to the server (meaning having a proper login shell...) but the account is enabled and may have a passwd... really not the same as disabled....
# 3  
Old 09-29-2014
Why not just lock the account passwd -l bob and leave it with a valid shell. That way you can still use sudo su bob but on one can log in as bob.
# 4  
Old 09-29-2014
Accounts can exist with several status settings - no network login, locked, active.

On most systems:
Code:
passwd -s bob

will show you the status. Also unless you have something like:
Code:
stevendaryl ALL (root) = ALL

in /etc/sudoers, you have to be root to execute authentication setup procedures.

The correct command to become bob and get the "bob" environment:
Code:
su - bob  # as root
sudo su - bob  # as stevendaryl

Note the dash with spaces around it.l

And what you want to do is common on every Linux/unix box - permanently locked user accounts like noaccess, lp have been part of the unix scene for a really really long time.
# 5  
Old 09-29-2014
Manpage for cron - man.cx manual pages

Quote:
cron and at jobs will be not be executed if the user’s account is locked. Only accounts which are not locked as defined in shadow(4) will have their job or process executed.
# 6  
Old 09-30-2014
The locked user should still be able to run cron jobs if they are setup in /etc/security/access.conf eg:

Code:
+ : bob : crond

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

2. Shell Programming and Scripting

CRON JOB not running - for tape backup from root user

I am trying a cron on root user to backup to tape using TAR command here is the cron entry 11 08 * * 6 /erdhot1cron 2>&1 >> /test3/scripts/dba/erdhot1cron.log here is script inside - edhot1cron #!/bin/bash vsysdt=`date +%d%m%y` date tar -cvf /dev/st0... (4 Replies)
Discussion started by: vijaymec50
4 Replies

3. Shell Programming and Scripting

Commented cron job -- cron monitoring

Hi I have a requirement to write a shell script,that will check the all commented job in cron job.Please help !! (2 Replies)
Discussion started by: netdbaind
2 Replies

4. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

5. Shell Programming and Scripting

Does running a cron job of a user require the user to be logged in?

Suppose user 'asdf' is not logged into server 'bbbb', but the server is up. User 'asdf' has cron job. Will it be executed? (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

6. Solaris

Is user cron job running in background?

Hi, Should the user jobs specified in crontab be running in background? Cron daemon is already running in background. So I am not sure whether should the jobs (output and error messages are redirected to file) ran by it be explicitly stated to be run in background (& at end of command) if one... (1 Reply)
Discussion started by: joe_x
1 Replies

7. Shell Programming and Scripting

Cron job initiating ssh AND sudo (from user, not root)

I've been bashing my head on the desk for 2 days trying to get this to work, but I've had no luck. I'll try to be as clear as possible in my explanation without dragging out the details. I'm trying to set up a cron job for user "john" which runs a script. This script initiates an ssh connection to... (5 Replies)
Discussion started by: eh3civic
5 Replies

8. UNIX for Dummies Questions & Answers

shell script run by user or cron job ?

My shell script runs fine both as a cron job and when i issue it. However, I wish to differentiate when it runs as a cron-job so the "echo" statements are not issued (they get mailed to me, which i don't want). I tried checking $USER but since the cron was created in my user that does not... (5 Replies)
Discussion started by: sentinel
5 Replies

9. Solaris

cron job starts new cron proccess

I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies

10. UNIX for Dummies Questions & Answers

CRON usage for CRON job

can anybody explain the usage of CRON for adding a cron job. please provide an example also for better understanding !!! Thanks (1 Reply)
Discussion started by: skyineyes
1 Replies
Login or Register to Ask a Question