How to Access Your Windows PC from Linux

Although the monopoly of the desktop market is still dominated by Microsoft Windows, Linux has long since established itself as the most viable option for server based computing environments. Therefore, most of the network systems nowadays, regardless the number of hosts that are always connected through one or more Linux servers. Due to this multi-infrastructural settings present in network environments, sharing files between Linux machines and Windows powered machines is a common scenario which will be very useful for us to have the know-how.

Samba server is the method using which you can enable a Linux box to share files over a network with a Windows box and vice-versa. Samba provides file and print services to SMB/CIFS clients whom are running on Windows, Linux/ UNIX flavors, Mac OS and a wide variety of operating systems.

Accessing files residing on a Windows PC from Linux can be achieved in two ways.

  • Using SAMBA client via command line
  • Using GUI tools
Access Windows PC from Linux
Soufce: techotopia.com

Using SAMBA Client via Command Line

In your Windows box, assume you have a central shared folder. Whatever files that would be put into this folder can be shared with any other remote machine Linux or Windows over a network. For explanation purposes, let us name your Windows box as WIN-PC and your share folder as WIN-SHARE.

Step 1

In order for your Linux box to identify WIN-SHARE folder, it should be mounted on Linux. The mount point is a directory at the location, /mnt/win. Type the following commands on the terminal.

# mkdir -p /mnt/win
# mount -t smbfs -o username=<
username>,password=<password> //WIN-PC/WIN-SHARE /mnt/win
# cd /mnt/win
# ls -l

You need to replace <username>,<password> with your login name and the password of your windows machine.

Step 2

The above command will mount //WIN-PC/WIN-SHARE only for one time use. For the mounting to happen every time Linux system reboots, add the following line in /etc/fstab:

  • Open a terminal
  • Type:

# vi /etc/fstab

  • On the editor add the line:

//WIN-PC/share /mnt/win smbfs auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15, credentials=/etc/sambapasswords 0 0

Step 3

Create the password file at /etc/sambapasswords:

  • Open a terminal
  • Type:

vi /etc/sambapasswords

  • On the editor add these lines:

username = <windows login name>

password = <windows login password>

Step 4

Secure sambapasswords file so that only the root can access it.

  • Open a terminal
  • Type:

# chown 0.0 /etc/sambapasswords

# chmod 600 /etc/sambapasswords

And that is it! You have just learned the tech-savvy method of accessing files residing on a Windows box from a Linux box. Next, we take a look as to how we can do this without any complicated syntaxes and just by a few clicks.

Using GUI Tools

  • Create a folder on your Windows machine,  right click, select Properties, click on sharing tab, turn on sharing.
  • Give a name for the shared folder (e.g. WIN-SHARE) in the box provided
  • Find the IP address of your PC :
  • Open the command prompt
  • type ipconfig
  • Note down the displayed IP address somewhere. (e.g. 192.168.10.5)
  • In your Linux box press ALT + F2 to open the Run dialog.
  • In the text box type the IP address and the shared folder name of your windows machine with the prefix

smb://192.168.10.5/WIN-SHARE

  • When you press run button in Run dialog, Linux will automatically connect to the Windows machine, access the specified folder and display the content on your Linux box.
  • If your Windows machine is password protected you may need to provide the password upon connecting.
  • You may also view the shared files if you go to Places, Networks. This will display all the Windows network shared folders your Linux machine is currently connected to.

1 thought on “How to Access Your Windows PC from Linux”

  1. I use samba when I am dealing with windows – eek! No more windows for me but some people still stick to it like junk food! So far, it hasn’t let me down. The only thing I would like to do is the domain administration which is using open LDAP. More small businesses are ditching windows and using linux. Who wouldn’t? easier to administer, less cost, and more stable. To make windows fall completely, if business developers start making software for linux, windows would crumble!

Leave a Reply to Imo EkpoCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.