My Ubuntu installation doesn't allow me to log in as root. But, it allows my user to escalate permissions and log in as root. I use WinSCP to transfer files from my Windows box to Ubuntu through SFTP. This works fine, except if I want to transfer files to a directory that requires root privileges. The solution involves changing WinSCP connection settings and allowing administrators to escalate sftp-server to root permissions without prompting for a password.
Long story short, it works.
First step is to edit /etc/sudoers on the Ubuntu side. Add the following line:
%admin ALL=NOPASSWD: /usr/lib/openssh/sftp-server
Then, edit WinSCP Configuration, Session Properties -> SFTP -> SFTP server. The value should be
Just what I needed. Believe it or not, the WinSCP FAQ is where I learned how to use sudo in an SFTP session. Go WinSCP!