You are not logged in.

#1 2009-09-07 03:37:29

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

[SOLVED] cron for user without shell

Is it possible to allow a user to execute cronjobs, without giving them a valid shell against their account?

I have a user that owns a website on my server (/srv/http/sites/domain.com) and there is a script that pulls data from another server via rsync so I want to run this script as the user.

I thought about changing the shell to /bin/bash and then adjusting .bashrc to just log the user out again, but the user has access to FTP so they could just delete the .bashrc file.

Last edited by fukawi2 (2009-09-07 22:23:55)

Offline

#2 2009-09-07 04:04:32

Goico
Member
Registered: 2009-09-06
Posts: 16

Re: [SOLVED] cron for user without shell

You could change the shell to /bin/bash, login as that user .. excecute "crontab ....", logout and then set the shell to /bin/false

Never done it .. but I think it should work

Offline

#3 2009-09-07 04:18:42

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: [SOLVED] cron for user without shell

No, not quite what I mean... I can edit the users crontab file by passing the -u option to 'crontab', but cron can't actually execute the commands without the user having a valid shell at the time the command is due to run.

Offline

#4 2009-09-07 09:49:05

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [SOLVED] cron for user without shell

Sounds like you're using vixie cron? dcron passes the cronjobs to /bin/sh, ignoring what the user's shell is declared to be (or even whether the user has a shell).

Or you could use my own, sweeter version of dcron: http://bbs.archlinux.org/viewtopic.php?id=78654

Offline

#5 2009-09-07 11:53:49

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: [SOLVED] cron for user without shell

Uhhh, I'll get back to you wink

Offline

#6 2009-09-07 22:23:39

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: [SOLVED] cron for user without shell

Indeed you are correct... I'm used to vixie-cron from my RedHat/Fedora days, and it indeed appears that dcron can handle this situation OK smile

Sorry for the noise, I'll consider this solved smile

Offline

Board footer

Powered by FluxBB