Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a machine where only some users should be allowed to login and execute commands over ssh, rest all users can ssh and run commands but should not login i.e no tty for other users.

Can someone help me with this.

share|improve this question

You should set up key-based authentication for your users on the ssh server.

Once you have key-based authentication configured, it's easy to set up the user's authorized_keys file to deny the user a tty using hte "no-pty" option for the key. Look at the man page for sshd and go to the AUTHORIZED_KEYS FILE FORMAT section for the available options:

share|improve this answer

Use SSH keys and specify the command= parameter in the authorized_keys file of users who should only run some commands.

In this command= parameter, pass a script which will check for the commands users can run.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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