Easy Windows-Linux File Sharing with a LiveCD

The intent of this article is to address a very specific case – it is not meant as a best practices guide.

Scenario:
A. You have a windows computer (Computer 1) with files that are remotely accessed from second windows computer (Computer 2). B. Access from Computer 2 is via a program that expects the files to be accessible under a specific computer name and share name. C. Computer 1 is currently unable to boot Windows (but has no relevant hardware problems – i.e. can still boot a LiveCD)

The solution I used was to boot up a Linux live CD, and share the files – changing the computer name to match the original, and giving the Samba share the same name. It worked seamlessly from the Windows end, and is fairly easy to setup – didn’t have to install a thing.

Linux Mint is my preferred Linux Desktop operating system, so I used a LiveCD of Linux Mint 12 (I presume Ubuntu 11.10 would be nearly identical). It should be noted that you can use UNetBootIn to create a bootable USB drive instead of using an actual CD.

Linux Mint 12 already has Samba installed, so once it boots up, there are only 3 tasks needed:

  1. Create a Samba user
  2. Change your Workgroup name and ‘Computer Name’ (aka the NetBios Name)
    • If you use the default workgroup, and do not require a specific ‘Computer Name’, you can skip this step.
  3. Share a folder

 

Optional Installation

If your specific scenario does not require the computer name to be something specific (i.e. ‘Mint’ will do), you can avoid using the terminal altogether:

  • Open Synaptic
  • Reload the packages (necessary for some packages to be displayed)
  • Mark system-config-samba for installation, and apply

A second optional install is gnome-network-admin which will let you change your hostname (which the NetBIOS name is obtained from) – however, I find it more successful explicitly setting this value.

 Create a New Samba User

Open a terminal and run:

sudo smbpasswd -a mint

The username needs to match a linux user – and mint is the user the live CD runs as. The command prompts for a password – set one of your choosing (doesn’t need to match anything).

(If you installed system-config-samba, you can create a new user under Preferences > Samba Users)

Change your workgroup and computer name

gksudo gedit /etc/samba/smb.conf

Under the [global] section:

  • Change the line ‘workgroup = WORKGROUP’ to specify your chosen workgroup.
  • Add the line ‘netbios name = computer-name’

If you make changes to smb.conf, restart samba:

sudo service smbd restart

If you changed the netbios name, restart the NetBIOS server:

sudo service nmbd restart

That is it for the terminal commands.

(If you installed system-config-samba, you can change the workgroup under Preferences > Server Settings)

Share a Folder

Linux side

Open the file manager (Nautilus) and mount the volume of interest (just click it on the left pane)

  1. Navigate to the folder you want to share
  • (If you are sharing the entire volume, navigate to /media – the volume you mounted should be listed)
  1. Right click the directory
  2. Select ‘Sharing Options’
  3. check ‘Share this folder’
  4. Set the ‘Share name’ of your choosing.
  5. Click ‘Create Share’

That’s all there is to it – a few steps, a few minutes, and relatively painless.

Windows side:

(I am presuming here that you had file sharing setup before)

  • Click Network (in explorer) and reload (F5) the view
  • Your remote computer should be displayed, double click it
  • The share you setup should be displayed, double click it
  • You should be prompted for your network password – enter ‘mint’ for the username, and the password you setup previously

… and everything should be ready to go

Notes

A point of mention – if you are not prompted for the password on Windows; check for entries under:

Start > Run > rundll32.exe keymgr.dll, KRShowKeyMgr

If there aren’t any, then try a restart to clear those stored in memory.

As a side note – I always find it amazing how much simpler things end up being than they start out. The steps I originally followed were at least twice as long – but most were simply unnecessary.

By cyberx86

Just a random guy who dabbles with assorted technologies yet works in a completely unrelated field.

10 comments

  1. Hi.

    Just wanted to say thanks for this guide. I screwed up our Windows 2003 raid server while trying to make a backup of the OS partition (still not sure how this happened). Anyway, it wouldn’t boot but all the partitions/files were there. I knew there must be a way to use a live CD to get everything temporarily back on the network, but I didn’t exactly know how to do it. Your guide saved my ass. Thanks a ton.

    Now if you only had a guide describing how to fix an ‘Error Loading Operating System’ message….

    Thanks again!

    1. Glad it was helpful to someone. As for your other error, if you don’t find a solution, post it on ServerFault – someone there will probably be able to help you out. (RAID complicates things a bit – but the cause will probably come down to the device your BIOS is loading, the drive geometry, the data on the boot sector, and/or the bootloader itself. Solutions may include fixmbr, fdisk /mbr, and explicitly ensuring the drive uses LBA.

  2. Thanks.

    This article is very helpful. My hard disk is damaged and I could not boot into Windows and Ubuntu installed on that drive. After going through the steps above, I am now able to move data from old hard drive to my new one!

      1. Can I re-publish this article on my blog?
        I will write in my own words and will include screenshots.

        I will include the backlink to this article.
        If you insist, I will post as a Guest Article on your name, along with Copyright notice.

        I believe, this site does not publish on any illegal stuff.
        Let me know your opinion.

        Regards,
        DaxServer

        1. Thanks for your interest. You are most welcome to re-publish the article, in your own words, on your blog. A link as part of the article would be appreciated, but is not required.

  3. Nice article. I was just looking to see if anyone has ever tried to share folders from a live-CD and your how-to pointed out another samba GUI to use which was quite helpful. I too am using Linux Mint (vers. 15, Mate edition) and the GUI that comes installed wouldn’t allow me to add shares so I installed system_config_samba and off I went… Yey! 😉 If people knew all the uses you can put a live-CD to, everyone would permanently keep one in their computer’s DVD reader like I do. Need to run a piece of software one time only? Re-boot into the live-CD. Need to test the latest greatest software? Re-boot into the live-CD. Need to rip DVDs but you’re not sure which ripper to use? Re-boot into your live-CD. Itching to play a game but don’t want to keep a lot of games on your harddrive (assuming the game doesn’t require too much resources)? Ditto. … I’ve even done LAMP development this way as well as .NET development… It’s like having a temporary virtual machine at the ready all the time and you don’t have to worry about messing anything up! If you’re not doing anything more useful with your DVD player, put it to use… Keep a live-CD in it! And BTW, I highly recommend Linux Mint 15 w/Mate (especially if your a developer) because it’s rock solid stable, packs a rich bundle of installed software and its UI leaves little to be desired (some distro’s don’t even implement drag/drop onto icons, onto panel applets or across workspaces and onto *any* app regardless of whether its hidden beneath other windows or not… The Mint team left *nothing* out). Oh, and it’s configurable beyond imagination for anyone who really likes to customize their desktop…

    1. Agreed – it is a nice build. Although, I have started having a fondness for building my own LiveCDs – handy when you want to add some custom item to them (also, handy to build a live USB drive instead of a CD).

  4. Thank you so much for this article! My laptop’s HDD died and I was able to recover files by burning an Ubuntu LiveCD and then following your instructions. My laptop and other PC had Windows 7.

    However, after copying over about 60% of my files, I lost the network connection to Ubuntu in Windows. I had to follow the instructions from this page in order to get it working again: http://www.noobslab.com/2012/03/configure-samba-sharing-between-ubuntu.html

Leave a comment

Your email address will not be published. Required fields are marked *