"NYWalker" <mr.shanjing@gmail.comwrites:
>Does this mean
>echo "mkdir /tmp/testdir" | ssh userid@anothermachine
>should be prohibited?
>>
>How to enforce such kind of security rule? Is there ssh configuration
>I should take a look at?
If you demand password logons then the user wil have to log on before
running commands. If the user is using passwordless logon, then the
exchange of rsa/dsa keys IS login. Ie in any case the user will not be able
to run commands before logging in tothe system.
Under ssh, the user cannot ever run commands before logging onto the
system.
>If ssh key is setup correctly between the two hosts, I don't think you
>can prohibit something like
>ssh userid@anothermachine '"mkdir /tmp/testdir"
>By defination, the above unattended session is a valid login - last cmd
>will show it's a login in the record.
>However, you may want to see if somework can be done in user's profile
>about setting the path or after a successful ssh authentication,
>the .profile prompts a question before allowing user to get a shell
>prompt
JUst disallow password less logins.But why you would want to do that is
beyond me.