I need to copy files via ssh but I am getting permission denied.

How can I log as a root by windows clients such us FileZilla/WinSCP?

I try execute command:

sudo su, but I am getting error: You must have tty to run sudo.

I try to resolve this error but without luck.

link|improve this question
A little trick is you can use /tmp as a temporary place and then move the files from it, beware of security and space limitations though. – Shadok Aug 24 '11 at 13:27
feedback

migrated from serverfault.com Aug 24 '11 at 13:37

This question came from our site for system administrators and desktop support professionals.

3 Answers

With WinSCP, check the "Avanced Options" box. In the Environnement>SFTP section, select the "sudo su -c /bin/sftp-server" option.

Indeed, your SSH server has to be configured to allow you lauchning such command.

link|improve this answer
feedback

You have to consider to log in as your root user on the server rather than using su or sudo, this could be done by username or password or via a key file. However, the server should allow you to do this; if not, there is not much that you can do to remotely gain root acces...

link|improve this answer
I logged in by key/username which I get from my boss, but it gives me nothing at all, I can't copy files at all – drupality Aug 24 '11 at 12:52
feedback

What the basic problem here is that there is a protection again non-human input. TTY ensures that the action is performed from keyboard actions, and not from another program. Now there is a way around this.

If you have access to the sodeors file you can deal with this. It is not really recommended but here goes, this is really a way that works.

You open the file /etc/sudoers and you find the following line:

Defaults:myusername    !requiretty

This tells the the system that the user myusername can perform non-keyboard actions. Now you can work with all your files using the sudo command.

Best is to try to avoid this.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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