The Virtual Machines is an important part of any one working over the cloud. However many projects required full control over servers, as example in rozn we used to build eCommerce systems that need full control over the servers to enable dynamic corns, messages and software integrations. In this blog shows how to add FTP and access your files with any of thous clients like FileZilla on Windows Azure Virtual Machine, we will start directly on the steps in the paragraphs below.
Make Sure your EndPoint inbound port is allowed
before we create the account from the terminal we should open the inbound port for SSH, go to your virtual machine on azure portal and click on resource group, then click on the Network security group, then click on Inbound security rules and make sure the port 22 is enabled via TCP port, if not just add it as allowed ports, you can find more details in this Link.
Work with terminal
Now we are logged to the VM, we have to generate user keys to enable access the VM through SFTP, as the following command
ssh-keygen -b 2048 -t rsa -f ~/your_azure_user
Were your “your_azure_user” is your main user on the VM, after execute the command the shell will ask you to provide your password for the key, therefore you have to fill it and press enter and then confirm the password and press enter.
Now you have create keys (private and public) for your user, we need to copy them in the main user home directory using the following command:
cat ~/privatekey >> /home/your_azure_user/.ssh/authorized_keys
cat ~/publickey.pub >> /home/your_azure_user/.ssh/authorized_keys
Make sure that ssh configuration enable Public key Authentication and RSA Authentication. However open ssh config file using the follow command:
sudo nano /etc/ssh/sshd_config
and make sure to uncomment the following lines
Now copy your private key content by open it and mark the content and click on the right mouse button, you can use the below code to open it.
sudo nano ~/privatekey
Past the private key in a text file and save it, then open puttygen and click on import, select the private key and enter the password (same password you enter when generating the keys), finally click on generate and puttygen will generate your ppk.
Now all we need to do is to open FileZilla and click on Edit->Settings and go to SFTP and add the ppk file.
Then connect to the VM by enter the ip as host and your username and password, you should now be connected to your VM.