Allow ssh access to multiple users on GoDaddy's shared hosting without sharing your password
My aim was to allow a couple of colleagues to ssh into my shared hosting server at GoDaddy. If it was any other server, I could have very well created another user which could be used by anyone else who needs access to the server. But, on GoDaddy shared hosting servers you get just one ssh user, hence this blog entry. As described in Max Beatty's blog, its a very simple job. But my approach was a little different, I did not want to keep copying everyone's public key into my godaddy server's .ssh/authorized_keys2 file. Instead of that, I created a new public/private key pair
Next, step which is similar to Max's approach is to copy the newly generated public key onto our server.
If you're on a linux system, you can use ssh-copy-id, which does it quite neatly.
Now, you just need to share your id file located at ~/.ssh/id_rsa with anyone who needs to get ssh access to you GoDaddy shared hosting server. What they need to do is, use the id file whenever they try to ssh into your server. That can be using the following command.
The parameter -i can be used to specify an id file to be used while connecting to an ssh server. So, your friend/colleague simply needs to replace ~/.ssh/d_rsa with the path to the id file they got from you.
NOTE: It's not a good idea to share your id file with a lot of people, because of this, even if you already have a private/public key pair generated, do not share that one. Also, if you're using applications which use your ssh id file to validate your identity like git, then you definitely shouldn't share your existing id file. Instead, generate a new one - one which you wouldn't mind sharing with a lot of people.
[ausmarton@ausmarton ~]$ ssh-keygen
Next, step which is similar to Max's approach is to copy the newly generated public key onto our server.
[ausmarton@ausmarton ~]$ scp ~/.ssh/id_rsa.pub user@remote-host:.ssh/authorized_keys2
If you're on a linux system, you can use ssh-copy-id, which does it quite neatly.
[ausmarton@ausmarton ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
Now, you just need to share your id file located at ~/.ssh/id_rsa with anyone who needs to get ssh access to you GoDaddy shared hosting server. What they need to do is, use the id file whenever they try to ssh into your server. That can be using the following command.
[ausmarton@ausmarton ~]$ ssh user@remote-host -i ~/.ssh/d_rsa
The parameter -i can be used to specify an id file to be used while connecting to an ssh server. So, your friend/colleague simply needs to replace ~/.ssh/d_rsa with the path to the id file they got from you.
NOTE: It's not a good idea to share your id file with a lot of people, because of this, even if you already have a private/public key pair generated, do not share that one. Also, if you're using applications which use your ssh id file to validate your identity like git, then you definitely shouldn't share your existing id file. Instead, generate a new one - one which you wouldn't mind sharing with a lot of people.
hello
ReplyDeleteThanks for your post!
Would this allow to restrict file and directory rights for this newly created user?
Dan
You're welcome Dan.
DeleteWe are not really creating a new user here. In fact, the pricing plan that I opted for, didn't allow more than 1 user to be able to access the server.
So, basically you would not be able to set any directory/file access restrictions on any one else that logs in to this user.
To make it simpler, it as good as sharing your user-id/password with someone else. Only difference here is that you don't disclose your password. But again, it doesn't give you any added security over sharing your password.