I'm needing to work out a way of restricting a user (ssh login on ubuntu 10.04) to only be allowed to do the following:
- Upload txt files only (through SCP or SFTP)
- Execute the php command "php somefile.php"
Is this feasible?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
You could change the users shell (in
/etc/passwd) to a custom shell...
#!/bin/bash php somefile.php # You might need to give the full path to the php-bin. bash -r -c read
Save it in
/bin, add it to
/etc/shells and make it runnable. The user can still use SCP and SFTP, but when he tries to open a shell, the php will run. If he enters, the shell will close.
It would probably be easier to serve the php script over a web server, and offer a text file upload through the same site. That way you can have incredibly fine control over what's allowed and what's not.