HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Command restriction - SSH
Operating System - Linux
1830224
Members
2026
Online
109999
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2004 07:24 PM
02-24-2004 07:24 PM
Hi!
I would like to set up some accounts on a linux server with restrictions to the number of commands that users will be able to execute.
I want some accounts to only access to their home or other directories only with SFTP to upload backup files, but I don't want them to use their login for other purpose on this machine. How can I achieve that?
And if I want to restrict the user to 5 commands for example?
Thank you
I would like to set up some accounts on a linux server with restrictions to the number of commands that users will be able to execute.
I want some accounts to only access to their home or other directories only with SFTP to upload backup files, but I don't want them to use their login for other purpose on this machine. How can I achieve that?
And if I want to restrict the user to 5 commands for example?
Thank you
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2004 07:35 PM
02-24-2004 07:35 PM
Re: Command restriction - SSH
Simple way is to create a directory into which you copy the commands you want the user to have. Then set the users PATH to only point into that directory. This obviously doesn't stop them changing their PATH (can you make PATH read only?).
You can getmore sophisticated by using things such as the restricted shell "rsh" which stops them changing directories and the like. FInally, you can consider compining the above with "chroot" with which you can make their home directory the "root" directory for them. There is no way of breaking out of that.
You can getmore sophisticated by using things such as the restricted shell "rsh" which stops them changing directories and the like. FInally, you can consider compining the above with "chroot" with which you can make their home directory the "root" directory for them. There is no way of breaking out of that.
Never preceed any demonstration with anything more predictive than "watch this"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2004 01:03 AM
02-25-2004 01:03 AM
Solution
Hi,
What I'd recommend is to set up a chrooted sftp server. The advantage of a chrooted ftp environment is that you can determine which commands can be run (as you create a separate environment you decide what files you copy). Since you only want the users to ftp to this machine it probably doesn't matter where their homedir is. For instance, you could create them in /opt/ftp/chroot/home/.
To restrict the user to 5 commands can be achieved by changing the amount of simultaneous logins. See your config file for this (I'm not sure sftp can achieve this, it seems pretty simple.) I recommend you use pure-ftp (http://www.pureftpd.org/), which supports SSL/TLS and does all of the above and is widespread.
A good start to set up sftp (from OpenSSH) can be found here:
http://mail.incredimail.com/howto/openssh/addons/sftp-chroot.howto.txt
Hope this helps,
Robert
What I'd recommend is to set up a chrooted sftp server. The advantage of a chrooted ftp environment is that you can determine which commands can be run (as you create a separate environment you decide what files you copy). Since you only want the users to ftp to this machine it probably doesn't matter where their homedir is. For instance, you could create them in /opt/ftp/chroot/home/
To restrict the user to 5 commands can be achieved by changing the amount of simultaneous logins. See your config file for this (I'm not sure sftp can achieve this, it seems pretty simple.) I recommend you use pure-ftp (http://www.pureftpd.org/), which supports SSL/TLS and does all of the above and is widespread.
A good start to set up sftp (from OpenSSH) can be found here:
http://mail.incredimail.com/howto/openssh/addons/sftp-chroot.howto.txt
Hope this helps,
Robert
linux: the choice of a GNU generation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2004 09:53 PM
02-25-2004 09:53 PM
Re: Command restriction - SSH
You could also use SSH keypairs that have single commands attached to them, or Sudo so that they would none interactive access to these accounts.
I know this is more complicated than a complete chroot jail, but once setup it can be easier to administer.
If the users are non-technical you could wrap your commands in a simple shell-script/menu that is executed as soon as they login.
I know this is more complicated than a complete chroot jail, but once setup it can be easier to administer.
If the users are non-technical you could wrap your commands in a simple shell-script/menu that is executed as soon as they login.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP