Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to download files from a linux system using a windows client. While there are many SFTP clients I am having the problem, that I need to access files where I need to be root. On the linux system I have the root account disabled, I am using sudo to get root privileges. How to execute "sudo" using an SFTP client? I don't want to change my linux system! Thanks for any hint!

share|improve this question

2 Answers 2

As sftp does not run commands you'd have to run the sftp module itself with sudo. But as there is no terminal attached after you logged in you must be able to run sudo without a password.

For a detailed howto with winscp have a look at http://winscp.net/eng/docs/faq_su#use_sudo_on_login

share|improve this answer

If your server only allows the SFTP protocol, you can't combine that with sudo, you'll have to find another method. If your server allows arbitrary shell commands, you can use sudo, but most file transfer programs don't have a feature to invoke it and pass it a password.

One client that does allow combining ssh with sudo to access files is Emacs (through Tramp, which is built into Emacs since version 23). See Open file via SSH and Sudo with Emacs. You can use dired (also a built-in Emacs feature) to manage files.

It would be more convenient to use SSH to become root. If you use a password-protected key that is only accepted from localhost, the security is equivalent to a standard sudo setup. See Copying protected files between servers in one line?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.