0

Suppose i create a new user TEST in ubuntu and i need to block all commands except cp,ssh,exit.Please help me.i am new to linux.

2 Answers2

1

Alternatively, consider using some restricted shell like rbash which you might set up as the user's login & ssh shell (use chsh and/or configure his/her's ~/.ssh/config); of course set up the PATH appropriately, it might contain a single ~/bin/ directory containing symlinks to /bin/cp, /usr/bin/ssh, etc. You might want to make ~/bin/ not owned and not writable by the user.

Be careful: if your user is more experimented than you are, you might leave some holes that he/she would be able to exploit. Make it also a social/contractual issue, by at least explicitly forbidding (in words) things.

You might also want to learn more about chroot and/or setuid; see also the references in this answer.

Notice that if your user gets ssh, he is likely to get scp and be able to hack his account (e.g. by adding executable files into his ~/bin/ ....)

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
0

I think you need to create a new group in which you set all the commands you want to use and add your TEST user to this group.

Kruncho
  • 195
  • 1
  • 13