I want to create a user on debian which can do following:

  1. Login via SSH.
  2. Create SVN repo and create post-commit hook.
  3. chmod and chown another directory to apache and 777.

How I can achieve that? As far as I see I have several tasks to deal with:

  1. Create user
  2. Enable SSH login for it.
  3. Restrict it's access to several directories and files.
  4. Restrict it's access to several commands.
  • 3
    You really don't want to chmod 777 anything that apache touches. – user9517 May 10 '12 at 6:36

I would suggest providing more details for a better answer however...

New users have ssh access by default if you use 'adduser'( vs useradd) and fill in the answers. From there you can change the home directory for the user in /etc/passwd . This is assuming you haven't customized your sshd_config file.

As for chowning, I believe your going to need give access to a script or the like via sudoers. I don't believe users can set the OWNER of a file to something other than themselves. Only root.

Limiting commands? Check this https://stackoverflow.com/questions/402615/how-to-restrict-ssh-users-to-a-predefined-set-of-commands-after-login . Other options include rbash, chroot, etc.

| improve this answer | |
  • Ok. TY. This seems to be what I was looking for. – Jevgeni Smirnov May 10 '12 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.