SFTP support

Advertisement

aleksaldo
Guest

SFTP support

Hi, I have used WinSCP SFTP for quite some time. Then I decided to use it to upload and edit files in root. I couldn't do that even when my user has NOPASSWD to sudo. So I saw on this page I could type sudo before the SFTP server in the SFTP tab. I did like this sudo /usr/libexec/openssh/sftp-server but it won't connect. It will connect with /usr/libexec/openssh/sftp-server. Why won't it do it with sudo like that post said?
How do I change user after login (e.g. su root)?
Please help, I really need to be able to edit root.

Reply with quote

Advertisement

RobHam
Joined:
Posts:
15
Location:
Wales, UK

My method to edit root user files when I am logged in as a standard user is to open a PuTTY terminal session and then type
sudo nano /file_path/file_name
and to create a blank root user file ready for editing use
sudo touch /file_path/file_name
Perhaps a wishlist item could be a way of running the WinSCP GUI editor as a super user by opening a second SFTP connection just for the editor and somehow swapping the user with su to root for this second connection.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
42,911
Location:
Prague, Czechia

Re: sftp support

@aleksaldo: Sorry, I'm not an *nix expert. The FAQ covers everything I know on the topic. It works for me. Try checking the server-side logs to see why it won't connect.

Reply with quote

aleksaldo
Guest

Re: sftp support

@martin: I'm not an expert with these servers and that stuff. But I found this in the log
sudo: sorry, you must have a tty to run sudo
Does that mean that I need to be connected throught a command line?

Reply with quote

aleksaldo
Guest

Sorry, I found out that I had to turn off requiretty. It said that it was disabled by default but I guess not.

Reply with quote

Advertisement

aleksaldo
Guest

Sorry for making several post it was no option to edit since I'm not registered.
I added the following line in my CentOS 6 sudoers folder because I didn't want all users to have requiretty off:
Defaults    requiretty
Defaults:aleksaldo !requiretty
Defaults!/usr/libexec/openssh/sftp-server !requiretty
(line nr 3 is just a security experiment)
Now it changed from:
sudo: sorry, you must have a tty to run sudo
to:
sudo: no tty present and no askpass program specified
But I have requiretty off for the user?

Reply with quote

martin
Site Admin
martin avatar

Looks like it is still trying to prompt you for a password. Make sure you have ALL=NOPASSWD set for your account, as per the FAQ.

Reply with quote

Advertisement

You can post new topics in this forum