I would like to create a user who can only do one thing: via ssh specify a script ( and commandline arguments to the script ) that resides in one particular folder
( for the purposes of this question let us call it
/local/remote_only_scripts/foo ) and have that script execute and return it's output.
To be clear some examples of things I do not want the user to be able to do:
- Locally log in to the account.
The login application is
/bin/login. It is not a script in the
/local/remote_only_scripts/foofolder, so should not be called by the user.
- Remotely log in to the account. Again login ( is that what is called by ssh? ) is not a script in the relevant folder.
- List the contents of the directory. ls is in
/bin/ls. It is not a script in the appropriate directory.
- Edit a file in that directory. emacs, vi, gedit most other editors are not scripts in that directoy.
- View the contents of a file in that directory.
- Execute a file in that directory that he does not have permission to execute.
Note that these are examples there are many other actions which I do not want the user to be able to do. In considering an action, ask "is this being done by a script in
/local/remote_only_scripts/foo?" if the answer is no the user should not be able to do it. If the answer is yes then the user should be able to do it.
PS: Let me clarify what I mean by "adding a user". I do not mean adding a user to some ssh subsystem. Rather I mean adding a user to the computer system. So, for example, I have a system running debian stable, call it by it's address, www.hg.bar.com. I want to add a user ( via kuser, users-admin or useradd or some similar way ) call him hg_guest. hg_guest cannot login locally or do any of the things in the above list. All hg_guest can do is execute scripts "remotely". I said he should be able to do so via ssh, but thinking about it now, maybe allowing him to use ssh may allow him to login in locally, so some other mechanism may be required.