I am new to the Linux world and trying to learn how to use SSH with LearnLinuxTV; the author, Jay, created a user ssh_config with:
Host myserv
Hostname xxx.xxx.x.xx
Port 22
User root
I can connect via ssh gusop@tty.sdf.org with the following in ~/.ssh/config:
Host sshtrainingserver
tty.sdf.org
Port 22
User gusop
After saving the file, I can't
ssh sshtrainingserverorssh gusop@tty.sdf.orgto work, always getting the following error; however, after deletingconfig, ssh works again.Bad owner or permissions on /home/gusop/.ssh/configls -l ~/.ssh/config:-rw-rw-r-- 1 Gusop Gusop 108 Mar 12 10:42 config
Could you please explain what is happening, as it feels like SSH doesn't like the config file?
ls -l /home/gusop/.ssh/config? Please [edit] the question and this information to the question body. – Kamil Maciorowski Mar 12 '22 at 09:32sshaccepts theconfigbeing-rw-rw-r--. You can try removing write access for the group (withchmod g-w ~/.ssh/config), in case yoursshis more restrictive. But possibly your problem has something to do with the dot. If so, further investigation may be required. Unfortunately I cannot help you because I'm not familiar with SELinux. Hopefully someone else will help. Good luck. – Kamil Maciorowski Mar 12 '22 at 09:55~/.ssh/configis missinghostnamenext to the FQDN [tty.sdf.org]. @KamilMaciorowski userssh_config[~/.ssh/config] shouldn't be writeable by anyone but the user [man page] – JW0914 Mar 12 '22 at 14:18664does not makesshfail (while666does). Therefore I'm not sure if "by others" in the manual means "by others than the user" or "by others" in the context ofchmod's user-group-others. Or maybe Debian derivatives are different? If the OP'ssshis like mine, changing the permissions from664to644will make no difference. Maybe it's not like mine, but hopefully now you understand my doubts. – Kamil Maciorowski Mar 12 '22 at 14:22600if that works, unless there's a specific reason for the group or others to have read access to it (I'm not on a machine I can test that on at the moment) – JW0914 Mar 12 '22 at 14:27