Mount Windows share on Linux

Sometimes I still have to deal with Windows. :-/ This time it’s an office shared disk. I was able to mount it automatically but only root could write in it, which meant I couldn’t paste files from Nautilus.

To overcome this I added the following entry in /etc/fstab:

//192.168.0.1/deviceName$ /mountpoint cifs
domain=hq,username=myUsername,password=myPassword,
_netdev,uid=username,gid=username 0 0

The _netdev option ensures the share is mounted only when the network is available, which is particularly useful on laptops that switch networks.

Once you have changed the fstab, unmount the network drive if it was already mounted:

sudo umount /mountpoint

and then mount it again:

sudo mount -a

If you only need occasional access to a Windows share, smbclient is a quick alternative:

smbclient //192.168.0.1/deviceName$ -U myUsername

This opens an FTP-like interface for browsing and transferring files.

Hope it works for you!

Linux: what is partition UUID and how to use it

If you have worked with Linux disks, you have seen device names like /dev/sda1. They work fine until you add or remove a disk — then the names can shift, breaking your mount points and scripts. UUIDs solve this because they are permanent and tied to the filesystem itself.

Instead of writing /dev/sda1 in fstab, use the UUID:

UUID=65b14742-9610-4289-8ea4-af8edcc5d8da /media/data ext4 defaults 0 2

There are a few ways to find the UUID of a partition:

sudo vol_id -u /dev/sda2
sudo blkid
ls -l /dev/disk/by-uuid/

On older systems vol_id was the standard tool, while blkid is the modern equivalent available on virtually all current distributions. You can also see the PARTUUID with blkid, which identifies the partition table entry rather than the filesystem — this is useful for booting with UEFI.

If UUIDs feel unwieldy, you can label a filesystem and use the label instead:

sudo e2label /dev/sda1 mydata
LABEL=mydata /media/data ext4 defaults 0 2

Labels are easier to read but not guaranteed to be unique. UUIDs are the safer choice for production systems.

Hope it works!