Setup Linux VM with SFTP, Guide for @msdev

This article will quickly shows, in particular for #msdev who’re not familiar with Linux, how to set up a 32 bit Fedora VM with VirtualBox, and setup a SFTP server, then connect from Filezilla client from Windows machine hosting the Fedora VM.

STEP 1. Create Linux VM on VirtualBox. First, download vdi/vmdk image of Linux operating system. Google for “vdi vmdk Ubuntu” for example. Make sure you download an x64 image with username/pwd specified! Similar for SuSE, Fedora …etc

Ubuntu x64                           (username: osboxes, pwd:


Ubuntu_12.04-64bit.7z                        (username: vuser, pwd: vuser)



Fedora x86        (username: root, pwd: Pwl!ghsnts.)

This version has Desktop pre-installed.

    Active user account(s) (username/password): root/reverse, fedora/reverse


Then follow these instructions.

Don’t forget to check “Enable PAE/NX”


And add a second Network Adapter if your first Adapter is configured in NAT mode.



“Please check the network settings of the Ubuntu VM. If it is configured in NAT mode (which is the default mode), then you will not be able to access your windows 7 host from your VM nor will you be able to access your VM from outside. If that is the case, you can add another virtual network adapter to the VM and configure the network mode as “Host-only Adapter”, so that it would get an IP address in the series of “”. Similarly, host will also acquire a virtual NIC and IP address Now you would be able to communicate between the VM and the host using the 192.168.56.x network.”

Please note that if you enabled this Host-only adapter, you wouldn’t be able to for example ping

You wouldn’t be able to:

yum repolist all
yum info kernel

Instead you’d get error:

Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again

(Anyway, you’d still need to fix a few things for yum to work. REF:

Also, if you’re downloading the vm to test mono, try download a supported distribution (Ubuntu, SuSE for example):


Also, Right-CTRL is default hotkey for VirtualBox to exit mouse capture.

*** The following steps for Fedora ***

STEP 2. Create user account:

groupadd sftp_users

useradd johndoe

passwd johndoe             (Then it will prompt you to enter the pwd for ‘johndoe’. For this exercise, pwd=SomePassw0rd)

usermod -G sftp_users johndoe

STEP 3. Then config and start SFTP server like this:

cd /etc/ssh

vi sshd_config

Press INSERT to enter text in vi.

Press ESC when done. Then “:wq!” to save+exit

To set /home as root folder, modify “ChrootDirectory” setting using vi, then hit “wq!”:

ChrootDirectory /home

Also, comment out and add a line like below

#Subsystem sftp /usr/libexec/openssh/sftp-server

Subsystem sftp internal-sft

Then restart the service:

systemctl restart sshd.service

And try connect locally:

sftp johndoe@localhost

Then, try connect to VM from your Windows workstation hosting the VM? From VM command prompt, type ifconfig (not ipconfig) to identify IP address of your VM (2nd Network Adapter).


Then from for example, Filezilla client:


Happy Coding!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s