1

I've configured chrooted SSH user on CentOS 7. Mounted /proc, /dev, /dev/pts to the user and installed required packages. And now I want to allow cron jobs for this user. How can I solve the task?

Server:

[root@localhost admin]# grep sftpuser /etc/passwd
sftpuser:x:1004:1003::/chrooted/dir:/bin/bash
[root@localhost admin]# id -a sftpuser
uid=1004(sftpuser) gid=1003(sftpuser) groups=1003(sftpuser),50(ftp)

[root@localhost admin]# uname -a
Linux localhost.localdomain 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

/etc/ssh/sshd_config:

...
Subsystem       sftp    internal-sftp
Match Group sftpuser
        ChrootDirectory %h
        AllowTcpForwarding no
        X11Forwarding no
...

Client:

-bash-4.2$ crontab -e
You (sftpuser) are not allowed to use this program (crontab)
kurgulus
  • 11
  • 2

2 Answers2

0

You can add a cron script for the user to run. It won't work as expected, as you won't be able to run it with the crontab options (day/hour...), but that may help anyhow:

* * * * * root /usr/sbin/chroot --userspec=user /chrooted/dir your_user_cron.sh
Yvan
  • 412
  • 4
  • 9
0

Have you tried putting the user into the /etc/cron.allow file (create it yourself, if it doesn't exist, yet)?

http://www.madirish.net/294

pToker
  • 51
  • 4