loginscript--run script-- logout
All,
I have an server. On this server there is a process which has the ability to start|stop|restart through an init.d script. There is one user that may execute these actions. The following we had in mind: User makes a ssh login; Script runs automatically and gives the three options; User picks an option; (Option is being carried out) User automatically logs out; The user may not interrupt the script in any way. Any idea where to start? done so far: Making an account named test who can only go to his home directory; some editting in the ~/.bash_profile |
Quote:
|
There is an elegant way to solve this problem - already built into ssh:
1.) Generate a public/private key pair for ssh authentication on your client machine: Code:
$ ssh-keygen -t rsa 2.) Transfer the public key (*.pub) to the server and attach it to the authorized_keys file of the user "test" Code:
$ cat insert_name_of_key_here.pub>> ~/.ssh/authorized_keys Code:
#!/bin/bash Code:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0OdXOI7Do22URpJXEYiRgV0Vd5/NXvyziwbuaOpGX4Ww2Knheci Code:
command="/path/to/script" Now you can use the private key file you generated in step 1 to login to your server: Code:
$ ssh -i private_key_file user@server I read this in some tutorial but I cannot find the link now. This should also be explained in some ssh or sshd man-page. Lotharster |
Quote:
|
Great Lotharster!!
I will try it. I let you know the result. Grt, Jaap |
Quote:
|
You have to replace "path/tp/script" with the script (full pathname) you want to be executed on login.
|
All times are GMT -5. The time now is 11:39 PM. |