<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: User creation only for SHH // How to in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/user-creation-only-for-shh-how-to/m-p/4468734#M37710</link>
    <description>&lt;!--!*#--&gt;If you want to force *all* users to use SSH, the simplest and recommended solution would be to disable (comment out) the other login methods (telnet, rexec, rlogin, rsh, ftp) from /etc/inetd.conf. Then send a "kill -HUP" to the inetd process to make it use the new configuration.&lt;BR /&gt;&lt;BR /&gt;But if you want to do this for *just one* user, it's a bit more difficult. Fortunately sshd sets up a special environment variable SSH_CLIENT: we can test in a login script if it exists and terminate the session if it is not there.&lt;BR /&gt;&lt;BR /&gt;Disclaimer: the following pieces of script are NOT TESTED, use them at your own risk. Test them well before using in production systems.&lt;BR /&gt;&lt;BR /&gt;Maybe adding something like this in /etc/profile would work:&lt;BR /&gt;(assuming that the username to block is "sshuser")&lt;BR /&gt;&lt;BR /&gt;if [ $(whoami) = "sshuser" ]; then&lt;BR /&gt;    if [ "$SSH_CLIENT" = "" ]; then&lt;BR /&gt;        logger -p auth.notice "Unauthorized non-SSH login attempt blocked"&lt;BR /&gt;        echo "Access Denied"&lt;BR /&gt;        exit # end session!&lt;BR /&gt;    fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;To stop the user from avoiding the block by changing his/her shell, you must also do the same thing in /etc/csh.login (using csh syntax):&lt;BR /&gt;&lt;BR /&gt;if ( "$user" == "sshuser" ) then&lt;BR /&gt;    if ( ! $?SSH_CLIENT ) then&lt;BR /&gt;        logger -p auth.notice "Unauthorized non-SSH login attempt blocked"&lt;BR /&gt;        echo "Access Denied"&lt;BR /&gt;        exit # end session!&lt;BR /&gt;    endif&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;You should also add the user to the ftpusers file to prevent him/her from using un-encrypted FTP. If you have other services that allow un-encrypted access, you should examine their documentation to find ways to disable them for that user.&lt;BR /&gt;&lt;BR /&gt;MK</description>
    <pubDate>Wed, 29 Jul 2009 07:41:50 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2009-07-29T07:41:50Z</dc:date>
    <item>
      <title>User creation only for SHH // How to</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-creation-only-for-shh-how-to/m-p/4468733#M37709</link>
      <description>Hello Guys&lt;BR /&gt;How do i create a user only for ssh.&lt;BR /&gt;the user must do anything without SSH&lt;BR /&gt;&lt;BR /&gt;Thanks;</description>
      <pubDate>Wed, 29 Jul 2009 04:55:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-creation-only-for-shh-how-to/m-p/4468733#M37709</guid>
      <dc:creator>txtraz</dc:creator>
      <dc:date>2009-07-29T04:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: User creation only for SHH // How to</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-creation-only-for-shh-how-to/m-p/4468734#M37710</link>
      <description>&lt;!--!*#--&gt;If you want to force *all* users to use SSH, the simplest and recommended solution would be to disable (comment out) the other login methods (telnet, rexec, rlogin, rsh, ftp) from /etc/inetd.conf. Then send a "kill -HUP" to the inetd process to make it use the new configuration.&lt;BR /&gt;&lt;BR /&gt;But if you want to do this for *just one* user, it's a bit more difficult. Fortunately sshd sets up a special environment variable SSH_CLIENT: we can test in a login script if it exists and terminate the session if it is not there.&lt;BR /&gt;&lt;BR /&gt;Disclaimer: the following pieces of script are NOT TESTED, use them at your own risk. Test them well before using in production systems.&lt;BR /&gt;&lt;BR /&gt;Maybe adding something like this in /etc/profile would work:&lt;BR /&gt;(assuming that the username to block is "sshuser")&lt;BR /&gt;&lt;BR /&gt;if [ $(whoami) = "sshuser" ]; then&lt;BR /&gt;    if [ "$SSH_CLIENT" = "" ]; then&lt;BR /&gt;        logger -p auth.notice "Unauthorized non-SSH login attempt blocked"&lt;BR /&gt;        echo "Access Denied"&lt;BR /&gt;        exit # end session!&lt;BR /&gt;    fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;To stop the user from avoiding the block by changing his/her shell, you must also do the same thing in /etc/csh.login (using csh syntax):&lt;BR /&gt;&lt;BR /&gt;if ( "$user" == "sshuser" ) then&lt;BR /&gt;    if ( ! $?SSH_CLIENT ) then&lt;BR /&gt;        logger -p auth.notice "Unauthorized non-SSH login attempt blocked"&lt;BR /&gt;        echo "Access Denied"&lt;BR /&gt;        exit # end session!&lt;BR /&gt;    endif&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;You should also add the user to the ftpusers file to prevent him/her from using un-encrypted FTP. If you have other services that allow un-encrypted access, you should examine their documentation to find ways to disable them for that user.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Wed, 29 Jul 2009 07:41:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-creation-only-for-shh-how-to/m-p/4468734#M37710</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2009-07-29T07:41:50Z</dc:date>
    </item>
  </channel>
</rss>

