1834149 Members
2852 Online
110064 Solutions
New Discussion

cron and user ID

 
SOLVED
Go to solution
Turlan
New Member

cron and user ID

Hi,

I'm wondering if there is a mean to have two different crontabs for two users who have the same user ID ?

Thanks for your help.
Olivier
6 REPLIES 6
harry d brown jr
Honored Contributor

Re: cron and user ID


If two PEOPLE share the SAME userid, then they are REALLY JUST ONE user as far as the system is concerned.

What kind of "crontab" entries would you have for these two people sharing a single userid??

Of course it's a violation of any known security rule.

live free or die
harry
Live Free or Die
Tom Maloy
Respected Contributor

Re: cron and user ID

Olivier,

I believe that two user names with the same user ID is trouble waiting to happen. You would be better off giving each a unique user ID. With the same ID, they are (effectively) the same user...

Tom
Carpe diem!
Ceesjan van Hattum
Esteemed Contributor

Re: cron and user ID

Two users with the same id in the /etc/passwd.. okay.. that can happen...
But these 2 users can belong to a different group maybe and have there own environment..

The manual says:
When cron executes a job, the job's user and group IDs are set to those of the user who submitted the job.

So there it is.. the jobs in different crontabs will/can have different permissions if the GID of the users are different.

Regards,
Ceesjan
Pete Randall
Outstanding Contributor

Re: cron and user ID

The crontabs get stored under individual user names in /var/spool/cron/crontabs so - if you've got two users sharing the sam name, the answer is no, you can't do this.

Pete

Pete
Shannon Petry
Honored Contributor

Re: cron and user ID

Well, I have to tell you that this question is asked way too often. I'll still give you a quickie, then tell you to search the forums for more info on this, as there alot.

First : John = John, and Mary = Mary, so how can anything differentiate?

Second:
John=UID 111
Mary=UID 111

Guess what? The system uses the UID (computers use numbers, names are just for human understanding).
So to the system, UID 111 = John and/or Mary.

If a process is started by John, cron gets the UID of 111 to launch the job. If Mary is sequentially higher in passwd than John she will get credit for most of the things that occur. John may like this but Mary sure wont.

The moral of the story is that ID's are supposed to be unique. Sharing an ID is no different than an anonymous FTP except that the anonymous person has free roaming privaleges on your system.

So, do yourself a favor ahead of time, and make them both have different ID's. You can use groups to give them access to the same files and programs, and even sudo to launch things as a third account.

Regards,
Shannon
Microsoft. When do you want a virus today?
Sean OB_1
Honored Contributor
Solution

Re: cron and user ID

The short answer is no, you can't do this since the system will see the UID and uses the same crontab file.

The long answer is that you should never have users with the same UID on the system, it will only wreak havoc.