Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 21804  / 2 Years ago, fri, october 21, 2022, 8:53:42

I am trying to remotely edit sshd_config file using WinSCP and putty. Unfortunately, I keep getting the following error-



“Cannot overwrite remote file Press delete to delete the file and create a new one”.



I tried deleting, but I got a similar error. I also tried changing the permissions on the file, but I got the error -



cannot change properties of file sshd_config.



I suspect I don't have the correct permissions, but I'm not sure what to do. I've attached a pic of my permissions below.



sshd_config file permissions



QUESTION



What do I need to do to be able to overwrite sshd_config ? Is it to do with my current permissions?


More From » permissions

 Answers
1

The answer actually turned out to be pretty obvious. I'm new to linux, so I was confused. When I logged into the server using the username and pw that I used to install the server, I was under the misunderstanding that this was the same as being root.



Anyway, I didn't have the correct permissions to edit the file, so to fix it I used Putty to ssh into the server then I created a new group called editors with the following code



sudo addgroup editors 


then I added my user to that group



sudo adduser myusername editors


Next I gave the group editors ownership of the directory



sudo chown :editors /etc/ssh/


Next I changed the file permissions such that the group could write to the folder



sudo chmod 770 /etc/ssh


After logging back into the server again with WinSCP I was able to edit the files in the directory.



This may not be the recommended way of going about this- if it isn't I'd appreciate someone letting me know :)


[#29940] Saturday, October 22, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oredoise

Total Points: 66
Total Questions: 116
Total Answers: 111

Location: Lebanon
Member since Sun, Aug 2, 2020
4 Years ago
;