0
I've configured a SFTP server on CentOS following this doc. My intention is to forbid the console login for the new users (user1
, user2
), which belong to the sftpusers
group, but still can log in to their respective sftp
folders.
Also, I want to use the same keys used by the CentOS user (which can log in to console and sftp
without problem). To do that, I copied the .ssh
folder from CentOS user to the user1
and user2
home folders, changing ownership to the users and 700
for the .ssh
folder and 600
for authorized_keys
file.
Still, I keep receiving the message Server refused our key
. The key used by the CentOS user is like a master key in all servers, that is why I want to reuse that key for the new users.
How can I achieve this configuration?
UPDATE
After generating keys for each user both users can access to server remotely with their privates keys but when I activate the following config in /etc/ssh/sshd_config
the permissions are denied using the sftp
command.
SSHD configuration
Match Group sftpusers #Or you could replace Group with User and specify a different configuration for each user
X11Forwarding no
AllowAgentForwarding no
AllowTcpForwarding no
ChrootDirectory /path/to/shared_folder/%u # %h the path to upload the files
ForceCommand internal-sftp
Message from shell
packet_write_wait: Connection to IPSERVER port 22: Broken pipe
Couldn't read packet: Connection reset by peer
What do you mean by console login? Local login as in "on the machine" or remote login using ssh to an interactive shell? – Seth – 2020-02-06T11:06:29.573
both of them, but mainly remote – Juan I. Morales Pestana – 2020-02-06T11:23:35.543
2I understand you copied things (like
authorized_keys
) inside the server. Users trying to log in from the outside obviously use their private keys stored outside the server. So do they use the same key actually? If they do (or going to), then what preventsuser1
to log in asuser2
orcentos
? Is such "commune" your goal? What ifuser1
turns malicious and needs to be banned? Are you going to ban the common key? and give a new key to everyone else? – Kamil Maciorowski – 2020-02-06T11:39:55.583Already done and checked the users are login with ssh remotely. Read updated question please – Juan I. Morales Pestana – 2020-02-06T13:47:50.460
The update introduces an issue different than the original question. It looks like the original issue is not a problem anymore. Am I right? If so, the old issue only obfuscates the question. The question should be [edit]ed and the old issue dropped completely. This includes changing the title. – Kamil Maciorowski – 2020-02-06T19:12:30.270