If you have spent any time managing a Linux server from a Windows machine, than chances are you are aware of the limitations to this setup. Copying files to the server with non-root access can be a chore to say the least. The following tutorial has been tested on Debian 8 and Ubuntu 16.04. In the tutorial below, we will detail the steps required to enable root file transfer while logging in with WinSCP as a non-root user. Keep in mind that you will still be required to enter your user credentials when using the sudo command in a terminal session through putty.
sudo
group./etc/sudoers.d
:echo -e "your_username ALL=(ALL) NOPASSWD: /usr/lib/openssh/sftp-server" > /etc/sudoers.d/winscp
Then in the SFTP setup section of WinSCP, edit the Server session advanced options by adding the command below under Protocol options (advanced edit window pictured below command):
sudo /usr/lib/openssh/sftp-server
If all the steps above went well, you should now have root access to the file system via WinSCP as a non-root user.
Now i also have this output sudo: no tty present and no askpass program specified
https://askubuntu.com/questions/281742/sudo-no-tty-present-and-no-askpass-program-specified
I follow all your steps but id doesnt work i got this message :
failed with return code 1 and error message
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] [VAR=value] [-i|-s] []
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] file …
Any idea why is this happening ?
What OS? Can you provide any other info that may help? Make sure “your_username” in the code block above is correct.
Ubuntu 16.04 Server, yes sir my username was there but still i am not allowed to change my user to root