Can I ssh via public key if there is no home directory on the remote system?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I currently have to ssh with user FOO then sudo to user BAR.
I would like to ssh using a public key, but on the remote system there is no home directory for user FOO, so obviously no .ssh/authorized_keys. Where can I put my public key ?
The /home directory is empty, so it seems no home directories are created for any user, and I don't have root on that system.
Thanks.
linux home key-authentication
add a comment |Â
up vote
4
down vote
favorite
I currently have to ssh with user FOO then sudo to user BAR.
I would like to ssh using a public key, but on the remote system there is no home directory for user FOO, so obviously no .ssh/authorized_keys. Where can I put my public key ?
The /home directory is empty, so it seems no home directories are created for any user, and I don't have root on that system.
Thanks.
linux home key-authentication
Not an answer, just a note: You will need the private key.
â ctrl-alt-delor
Feb 8 at 12:32
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I currently have to ssh with user FOO then sudo to user BAR.
I would like to ssh using a public key, but on the remote system there is no home directory for user FOO, so obviously no .ssh/authorized_keys. Where can I put my public key ?
The /home directory is empty, so it seems no home directories are created for any user, and I don't have root on that system.
Thanks.
linux home key-authentication
I currently have to ssh with user FOO then sudo to user BAR.
I would like to ssh using a public key, but on the remote system there is no home directory for user FOO, so obviously no .ssh/authorized_keys. Where can I put my public key ?
The /home directory is empty, so it seems no home directories are created for any user, and I don't have root on that system.
Thanks.
linux home key-authentication
asked Feb 8 at 12:21
ccc
211
211
Not an answer, just a note: You will need the private key.
â ctrl-alt-delor
Feb 8 at 12:32
add a comment |Â
Not an answer, just a note: You will need the private key.
â ctrl-alt-delor
Feb 8 at 12:32
Not an answer, just a note: You will need the private key.
â ctrl-alt-delor
Feb 8 at 12:32
Not an answer, just a note: You will need the private key.
â ctrl-alt-delor
Feb 8 at 12:32
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
Assuming your username is testssh:
- create /etc/ssh/authorized_keys_testssh and put your key there
add the following in /etc/ssh/sshd_config
Match User testssh
AuthorizedKeysFile /etc/ssh/authorized_keys_%u
and restart sshd. Your user will be able to ssh with his private key.
2
It's unlikely that this user has the permissions to do that. If they had elevated privileges then they could just give themselves a home directory, no?
â igal
Feb 8 at 13:43
1
indeed, this cannot be achieved without involving the admin (root).
â tonioc
Feb 8 at 15:38
2
But the question specifically states that the user does not have root access.
â igal
Feb 8 at 17:02
1
Thx for the suggestion tonioc, but igal is 100% right. Have very limited permissions on remote machine, which is why I specifically mentioned I don't have root. If I could create files in /etc, I could probably create a directory in /home and just do my stuff in there (create .ssh and .ssh/authrorized_keys)
â ccc
Feb 9 at 13:52
add a comment |Â
up vote
1
down vote
Short Answer
You probably can't - talk to your sysadmin.
Longer Answer
First of all, the fact that the /home
directory is empty (and even if it doesn't exist) doesn't necessarily mean that your user doesn't have a home directory. You can try looking at the value of the HOME
environment variable:
$ echo $HOME
/path/to/nonstandard/homedirectory
or use the getent
command:
$ getent passwd username
username:*:1001:1001:User Name:/path/to/nonstandard/homedirectory:/bin/bash
If it turns out that your user really does not have a home directory then it still might be possible to use a public key if your server administrator has set a nonstandard location for your authorized_keys
file.
Assuming you're using OpenSSH, the location of the authorized_keys
file can be specified by the AuthorizedKeysFile
keyword in the sshd_config
configuration file. Consult the documentation for more information:
- https://man.openbsd.org/sshd_config#AuthorizedKeysFile
The default value is ~/.ssh/authorized_keys
. You'll have to look at the settings in /etc/ssh/sshd_config
to see if the default is being over-ridden. Since you don't have root access you'll probably have to ask your system administrator for help if you want to make any changes.
If it turns out that you don't have a home directory, that your system administrator hasn't configured a different location for your authorized_keys
file, and you don't have administrative privileges on your machine, then you probably won't be able to use key-based authentication - talk to your sysadmin.
Thx. The home points to the nonexistent directory /home/FOO. In fact, /home is 100% empty. No user has a home directory, it seems.
â ccc
Feb 9 at 14:04
The root user probably has a home directory (it's usually/root
). You can check to see if other users have home directories by checking/etc/passwd
or usinggetent
(e.g.getent passwd | cut -d: -f6
). Anyway, have you asked your sysadmin to create a home directory for you?
â igal
Feb 9 at 14:25
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Assuming your username is testssh:
- create /etc/ssh/authorized_keys_testssh and put your key there
add the following in /etc/ssh/sshd_config
Match User testssh
AuthorizedKeysFile /etc/ssh/authorized_keys_%u
and restart sshd. Your user will be able to ssh with his private key.
2
It's unlikely that this user has the permissions to do that. If they had elevated privileges then they could just give themselves a home directory, no?
â igal
Feb 8 at 13:43
1
indeed, this cannot be achieved without involving the admin (root).
â tonioc
Feb 8 at 15:38
2
But the question specifically states that the user does not have root access.
â igal
Feb 8 at 17:02
1
Thx for the suggestion tonioc, but igal is 100% right. Have very limited permissions on remote machine, which is why I specifically mentioned I don't have root. If I could create files in /etc, I could probably create a directory in /home and just do my stuff in there (create .ssh and .ssh/authrorized_keys)
â ccc
Feb 9 at 13:52
add a comment |Â
up vote
1
down vote
Assuming your username is testssh:
- create /etc/ssh/authorized_keys_testssh and put your key there
add the following in /etc/ssh/sshd_config
Match User testssh
AuthorizedKeysFile /etc/ssh/authorized_keys_%u
and restart sshd. Your user will be able to ssh with his private key.
2
It's unlikely that this user has the permissions to do that. If they had elevated privileges then they could just give themselves a home directory, no?
â igal
Feb 8 at 13:43
1
indeed, this cannot be achieved without involving the admin (root).
â tonioc
Feb 8 at 15:38
2
But the question specifically states that the user does not have root access.
â igal
Feb 8 at 17:02
1
Thx for the suggestion tonioc, but igal is 100% right. Have very limited permissions on remote machine, which is why I specifically mentioned I don't have root. If I could create files in /etc, I could probably create a directory in /home and just do my stuff in there (create .ssh and .ssh/authrorized_keys)
â ccc
Feb 9 at 13:52
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Assuming your username is testssh:
- create /etc/ssh/authorized_keys_testssh and put your key there
add the following in /etc/ssh/sshd_config
Match User testssh
AuthorizedKeysFile /etc/ssh/authorized_keys_%u
and restart sshd. Your user will be able to ssh with his private key.
Assuming your username is testssh:
- create /etc/ssh/authorized_keys_testssh and put your key there
add the following in /etc/ssh/sshd_config
Match User testssh
AuthorizedKeysFile /etc/ssh/authorized_keys_%u
and restart sshd. Your user will be able to ssh with his private key.
answered Feb 8 at 12:54
tonioc
1,11457
1,11457
2
It's unlikely that this user has the permissions to do that. If they had elevated privileges then they could just give themselves a home directory, no?
â igal
Feb 8 at 13:43
1
indeed, this cannot be achieved without involving the admin (root).
â tonioc
Feb 8 at 15:38
2
But the question specifically states that the user does not have root access.
â igal
Feb 8 at 17:02
1
Thx for the suggestion tonioc, but igal is 100% right. Have very limited permissions on remote machine, which is why I specifically mentioned I don't have root. If I could create files in /etc, I could probably create a directory in /home and just do my stuff in there (create .ssh and .ssh/authrorized_keys)
â ccc
Feb 9 at 13:52
add a comment |Â
2
It's unlikely that this user has the permissions to do that. If they had elevated privileges then they could just give themselves a home directory, no?
â igal
Feb 8 at 13:43
1
indeed, this cannot be achieved without involving the admin (root).
â tonioc
Feb 8 at 15:38
2
But the question specifically states that the user does not have root access.
â igal
Feb 8 at 17:02
1
Thx for the suggestion tonioc, but igal is 100% right. Have very limited permissions on remote machine, which is why I specifically mentioned I don't have root. If I could create files in /etc, I could probably create a directory in /home and just do my stuff in there (create .ssh and .ssh/authrorized_keys)
â ccc
Feb 9 at 13:52
2
2
It's unlikely that this user has the permissions to do that. If they had elevated privileges then they could just give themselves a home directory, no?
â igal
Feb 8 at 13:43
It's unlikely that this user has the permissions to do that. If they had elevated privileges then they could just give themselves a home directory, no?
â igal
Feb 8 at 13:43
1
1
indeed, this cannot be achieved without involving the admin (root).
â tonioc
Feb 8 at 15:38
indeed, this cannot be achieved without involving the admin (root).
â tonioc
Feb 8 at 15:38
2
2
But the question specifically states that the user does not have root access.
â igal
Feb 8 at 17:02
But the question specifically states that the user does not have root access.
â igal
Feb 8 at 17:02
1
1
Thx for the suggestion tonioc, but igal is 100% right. Have very limited permissions on remote machine, which is why I specifically mentioned I don't have root. If I could create files in /etc, I could probably create a directory in /home and just do my stuff in there (create .ssh and .ssh/authrorized_keys)
â ccc
Feb 9 at 13:52
Thx for the suggestion tonioc, but igal is 100% right. Have very limited permissions on remote machine, which is why I specifically mentioned I don't have root. If I could create files in /etc, I could probably create a directory in /home and just do my stuff in there (create .ssh and .ssh/authrorized_keys)
â ccc
Feb 9 at 13:52
add a comment |Â
up vote
1
down vote
Short Answer
You probably can't - talk to your sysadmin.
Longer Answer
First of all, the fact that the /home
directory is empty (and even if it doesn't exist) doesn't necessarily mean that your user doesn't have a home directory. You can try looking at the value of the HOME
environment variable:
$ echo $HOME
/path/to/nonstandard/homedirectory
or use the getent
command:
$ getent passwd username
username:*:1001:1001:User Name:/path/to/nonstandard/homedirectory:/bin/bash
If it turns out that your user really does not have a home directory then it still might be possible to use a public key if your server administrator has set a nonstandard location for your authorized_keys
file.
Assuming you're using OpenSSH, the location of the authorized_keys
file can be specified by the AuthorizedKeysFile
keyword in the sshd_config
configuration file. Consult the documentation for more information:
- https://man.openbsd.org/sshd_config#AuthorizedKeysFile
The default value is ~/.ssh/authorized_keys
. You'll have to look at the settings in /etc/ssh/sshd_config
to see if the default is being over-ridden. Since you don't have root access you'll probably have to ask your system administrator for help if you want to make any changes.
If it turns out that you don't have a home directory, that your system administrator hasn't configured a different location for your authorized_keys
file, and you don't have administrative privileges on your machine, then you probably won't be able to use key-based authentication - talk to your sysadmin.
Thx. The home points to the nonexistent directory /home/FOO. In fact, /home is 100% empty. No user has a home directory, it seems.
â ccc
Feb 9 at 14:04
The root user probably has a home directory (it's usually/root
). You can check to see if other users have home directories by checking/etc/passwd
or usinggetent
(e.g.getent passwd | cut -d: -f6
). Anyway, have you asked your sysadmin to create a home directory for you?
â igal
Feb 9 at 14:25
add a comment |Â
up vote
1
down vote
Short Answer
You probably can't - talk to your sysadmin.
Longer Answer
First of all, the fact that the /home
directory is empty (and even if it doesn't exist) doesn't necessarily mean that your user doesn't have a home directory. You can try looking at the value of the HOME
environment variable:
$ echo $HOME
/path/to/nonstandard/homedirectory
or use the getent
command:
$ getent passwd username
username:*:1001:1001:User Name:/path/to/nonstandard/homedirectory:/bin/bash
If it turns out that your user really does not have a home directory then it still might be possible to use a public key if your server administrator has set a nonstandard location for your authorized_keys
file.
Assuming you're using OpenSSH, the location of the authorized_keys
file can be specified by the AuthorizedKeysFile
keyword in the sshd_config
configuration file. Consult the documentation for more information:
- https://man.openbsd.org/sshd_config#AuthorizedKeysFile
The default value is ~/.ssh/authorized_keys
. You'll have to look at the settings in /etc/ssh/sshd_config
to see if the default is being over-ridden. Since you don't have root access you'll probably have to ask your system administrator for help if you want to make any changes.
If it turns out that you don't have a home directory, that your system administrator hasn't configured a different location for your authorized_keys
file, and you don't have administrative privileges on your machine, then you probably won't be able to use key-based authentication - talk to your sysadmin.
Thx. The home points to the nonexistent directory /home/FOO. In fact, /home is 100% empty. No user has a home directory, it seems.
â ccc
Feb 9 at 14:04
The root user probably has a home directory (it's usually/root
). You can check to see if other users have home directories by checking/etc/passwd
or usinggetent
(e.g.getent passwd | cut -d: -f6
). Anyway, have you asked your sysadmin to create a home directory for you?
â igal
Feb 9 at 14:25
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Short Answer
You probably can't - talk to your sysadmin.
Longer Answer
First of all, the fact that the /home
directory is empty (and even if it doesn't exist) doesn't necessarily mean that your user doesn't have a home directory. You can try looking at the value of the HOME
environment variable:
$ echo $HOME
/path/to/nonstandard/homedirectory
or use the getent
command:
$ getent passwd username
username:*:1001:1001:User Name:/path/to/nonstandard/homedirectory:/bin/bash
If it turns out that your user really does not have a home directory then it still might be possible to use a public key if your server administrator has set a nonstandard location for your authorized_keys
file.
Assuming you're using OpenSSH, the location of the authorized_keys
file can be specified by the AuthorizedKeysFile
keyword in the sshd_config
configuration file. Consult the documentation for more information:
- https://man.openbsd.org/sshd_config#AuthorizedKeysFile
The default value is ~/.ssh/authorized_keys
. You'll have to look at the settings in /etc/ssh/sshd_config
to see if the default is being over-ridden. Since you don't have root access you'll probably have to ask your system administrator for help if you want to make any changes.
If it turns out that you don't have a home directory, that your system administrator hasn't configured a different location for your authorized_keys
file, and you don't have administrative privileges on your machine, then you probably won't be able to use key-based authentication - talk to your sysadmin.
Short Answer
You probably can't - talk to your sysadmin.
Longer Answer
First of all, the fact that the /home
directory is empty (and even if it doesn't exist) doesn't necessarily mean that your user doesn't have a home directory. You can try looking at the value of the HOME
environment variable:
$ echo $HOME
/path/to/nonstandard/homedirectory
or use the getent
command:
$ getent passwd username
username:*:1001:1001:User Name:/path/to/nonstandard/homedirectory:/bin/bash
If it turns out that your user really does not have a home directory then it still might be possible to use a public key if your server administrator has set a nonstandard location for your authorized_keys
file.
Assuming you're using OpenSSH, the location of the authorized_keys
file can be specified by the AuthorizedKeysFile
keyword in the sshd_config
configuration file. Consult the documentation for more information:
- https://man.openbsd.org/sshd_config#AuthorizedKeysFile
The default value is ~/.ssh/authorized_keys
. You'll have to look at the settings in /etc/ssh/sshd_config
to see if the default is being over-ridden. Since you don't have root access you'll probably have to ask your system administrator for help if you want to make any changes.
If it turns out that you don't have a home directory, that your system administrator hasn't configured a different location for your authorized_keys
file, and you don't have administrative privileges on your machine, then you probably won't be able to use key-based authentication - talk to your sysadmin.
edited Feb 9 at 14:27
answered Feb 8 at 12:46
igal
4,820930
4,820930
Thx. The home points to the nonexistent directory /home/FOO. In fact, /home is 100% empty. No user has a home directory, it seems.
â ccc
Feb 9 at 14:04
The root user probably has a home directory (it's usually/root
). You can check to see if other users have home directories by checking/etc/passwd
or usinggetent
(e.g.getent passwd | cut -d: -f6
). Anyway, have you asked your sysadmin to create a home directory for you?
â igal
Feb 9 at 14:25
add a comment |Â
Thx. The home points to the nonexistent directory /home/FOO. In fact, /home is 100% empty. No user has a home directory, it seems.
â ccc
Feb 9 at 14:04
The root user probably has a home directory (it's usually/root
). You can check to see if other users have home directories by checking/etc/passwd
or usinggetent
(e.g.getent passwd | cut -d: -f6
). Anyway, have you asked your sysadmin to create a home directory for you?
â igal
Feb 9 at 14:25
Thx. The home points to the nonexistent directory /home/FOO. In fact, /home is 100% empty. No user has a home directory, it seems.
â ccc
Feb 9 at 14:04
Thx. The home points to the nonexistent directory /home/FOO. In fact, /home is 100% empty. No user has a home directory, it seems.
â ccc
Feb 9 at 14:04
The root user probably has a home directory (it's usually
/root
). You can check to see if other users have home directories by checking /etc/passwd
or using getent
(e.g. getent passwd | cut -d: -f6
). Anyway, have you asked your sysadmin to create a home directory for you?â igal
Feb 9 at 14:25
The root user probably has a home directory (it's usually
/root
). You can check to see if other users have home directories by checking /etc/passwd
or using getent
(e.g. getent passwd | cut -d: -f6
). Anyway, have you asked your sysadmin to create a home directory for you?â igal
Feb 9 at 14:25
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f422790%2fcan-i-ssh-via-public-key-if-there-is-no-home-directory-on-the-remote-system%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Not an answer, just a note: You will need the private key.
â ctrl-alt-delor
Feb 8 at 12:32