Accessing shared files on Linux from Windows (trouble shooting / if solutions were always that simple)

The problem

I work in a shared Linux – Window environment and sharing files between computers has always been somewhat cumbersome. Most of the time I was able to access files in a shared folder on the Window machine from my Linux computer. But I never got it to work the other way around. The Windows computer simply did not see the shared folders on my Linux computer.

There are numerous blogs, email threads and forum articles dealing with similar problems. Solutions, if any, often involved tweaking Samba configuration. Alas, none ever worked for me.

The solution

And then I came across this observation in an email thread on Ubuntuforums that “a computer name in excess of 15 characters becomes invisible on the network”. Sure enough, my computer name was longer than 15 characters.

Could the solution really be that simple!? Yes, it was that simple! After changing my computer name it immediately was visible in Networks on the Window computer!

How to

If you have similar problems with your Windows computer not seeing your shared folders on your Linux computer, you may first want to check the length of your computer name before diving into more complicated solutions. You can see your current hostname by opening a terminal and typing on the command line:

hostname

If the name turns out to be longer than 15 characters, you can change it temporary by typing on the command line:

sudo hostname NEW_HOSTNAME_HERE

This will change the hostname until next reboot. To change the name permanently, you need to edit the host files. You can do this by running

sudo gedit /etc/hostname
sudo gedit /etc/hosts

Instead of using gedit, you can of course use your favourite text editor. In both files, change the name to what you want and save them. You need to restart the computer to apply the change.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s