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 couldnt 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 wont connect. It will connect with "/usr/libexec/openssh/sftp-server". Why wont it do it with sudo like that post said? https://winscp.net/eng/docs/faq_su#fn1 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:
41,253
Location:
Prague, Czechia

Re: sftp support

aleksaldo wrote:

Hi, i have used winscp sftp for quite some time. Then i decided to use it to upload and edit files in root. I couldnt 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 wont connect. It will connect with "/usr/libexec/openssh/sftp-server". Why wont it do it with sudo like that post said? https://winscp.net/eng/docs/faq_su#fn1 please help, i really need to be able to edit root.
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 wrote:

aleksaldo wrote:

Hi, i have used winscp sftp for quite some time. Then i decided to use it to upload and edit files in root. I couldnt 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 wont connect. It will connect with "/usr/libexec/openssh/sftp-server". Why wont it do it with sudo like that post said? https://winscp.net/eng/docs/faq_su#fn1 please help, i really need to be able to edit root.
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.
Im 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 of requretty. 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 im not registered*
I added the following line in my CentOS 6 sudoers folder because i didnt 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 requretty 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