I am using Azure VM for hosting. I created it with admin user lets say "woadmin" and SSH key. By following this guide https://virtubox.github.io/ubuntu-nginx-web-server/ I have enabled www-data user and changed its password. Now I am trying to connect my server with WinSCP with www-data user and its password but it does not allow me. I am able to connect with woadmin user and SSH key but this time I cannot write/change files on my web site cause the owner is www-data. How can I solve this problem? I am a novice user.
Not sure if I understand your problem, but if you want to connect with www-data via ssh you need to follow this:
Set a password for www-data
sudo passwd www-data
Edit /etc/passwd. Replace/usr/sbin/nologin or similar by/bin/bash on the line of the user.
Give permission for login via ssh, edit /etc/ssh/sshd_configand add the following line
you understood correctly mate, first 2 step is OK and I have added the line to sshd_config too. Putty gives and error message "no supported authentication methods available" and says "server refused our key". Now I am not able to login with original admin too : ) would u pls help?
I'm not familiar with putty, have you tried this?
will try, but now I dont know how to login !
You can reset your ssh credentials : https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshoot-ssh-connection
www-data can only login using password.
You can force the use of SSH keys with www-data but you'll need to keep your SSH keys in the /var/www/.ssh/ folder which is not a good/safe practice. It is better to create a seperate username and for all your SFTP needs.
groot it's not a bad practice as long as you only store the file authorized_keys with SSH public keys in /var/www/.ssh.
Hosted by VirtuBox