<p>Yes, but you will first need to log in as the master or root account, and then <code>sudo su otheruser</code> in order to log in as that user. There is no way to log in as any user without first going through a privleged user's account.</p>

<p>An additional caveat is that the user you are trying to log in as needs to have a shell of <code>/bin/bash</code> or similar valid shell in <code>/etc/passwd</code>. If the user has a shell like <code>/bin/fase</code> or <code>/bin/nologin</code> you will be unable to change to this user's account (but neither will anyone else for that matter). </p>

CC BY-SA 3.0
2017-10-30T15:19:38.953Z
2017-10-30T15:19:38.953Z
James Shewey
<p>edit your /etc/ssh/sshd_config and add</p>

<pre><code>AuthorizedKeysFile    /etc/ssh/all_users_authorized_keys
</code></pre>

<p>Put your pubkey in that file, and restart the sshd.</p>

<p>See:
<a href="https://www.ssh.com/ssh/authorized_keys/openssh" rel="nofollow noreferrer">https://www.ssh.com/ssh/authorized_keys/openssh</a></p>

<p>The default behavior (which we are all probably familiar with) is </p>

<pre><code>AuthorizedKeysFile    %h/.ssh/authorized_keys
</code></pre>

CC BY-SA 3.0
2017-10-29T20:31:02.020Z
2017-10-29T20:31:02.020Z
Jeremy
<p>Is there any possibility to create one master account (for one master laptop for example), from which I can log in to all accounts available on the server ?</p>

<p>My server has Keys Authentication enabled and PasswordAuthentication disabled.</p>

<p>Now, after reboot I can login to server from my (master laptop) as root, but I can not login as a regular user, I get „access denied".</p>

CC BY-SA 3.0
2017-10-28T14:43:17.513Z
I think more information is needed to be able to know what is the exact issue.
mico
CC BY-SA 3.0
2017-10-29T12:14:40.263Z
https://serverfault.com/a/108215/215599
030
<linux>
CentOS 7 SSH login with Keys Authentication
Tomas
# CentOS 7 SSH login with Keys Authentication

(Asked by: username_0 on 2017-10-28)

Is there any possibility to create one master account (for one master laptop for example), from which I can log in to all accounts available on the server ?

My server has Keys Authentication enabled and PasswordAuthentication disabled.

Now, after reboot I can login to server from my (master laptop) as root, but I can not login as a regular user, I get „access denied".

**Tags:** linux

> **Comments:**
> **username_1**: I think more information is needed to be able to know what is the exact issue.  
> **username_2**: https://serverfault.com/a/108215/215599  

---

## 2 answers

### Answer by username_3 on 2017-10-30. Score: 1

Yes, but you will first need to log in as the master or root account, and then `sudo su otheruser` in order to log in as that user. There is no way to log in as any user without first going through a privleged user's account.

An additional caveat is that the user you are trying to log in as needs to have a shell of `/bin/bash` or similar valid shell in `/etc/passwd`. If the user has a shell like `/bin/fase` or `/bin/nologin` you will be unable to change to this user's account (but neither will anyone else for that matter).


---

### Answer by username_4 on 2017-10-29. Score: 0

edit your /etc/ssh/sshd_config and add
AuthorizedKeysFile    /etc/ssh/all_users_authorized_keys

Put your pubkey in that file, and restart the sshd.
See:
https://www.ssh.com/ssh/authorized_keys/openssh
The default behavior (which we are all probably familiar with) is 
AuthorizedKeysFile    %h/.ssh/authorized_keys


---

