Skip to main content

Linux: mount a Windows share with CIFS

When you are a web developer and developing a software run on a Linux platform you might end up running your dev pc with Windows with a Linux virtual machine client. Then comes the question: how to share the source code transparently with the virtual machine and the host?
Here's a possible setup:
Windows 7 host, Ubuntu server in a VMware Player. On the host I share (with the simple Windows share, Samba if you like) my web development directory with all of the sources I would like the Linux server to use as well. Then I mount that share on through a bridged or host-only network interface on the Linux server with the following two choices:

1. Modify /etc/fstab. Add the following line:
//192.168.x.x/hostdir /opt/clientdir cifs username=hostuser,password=hostuserpass,uid=1000,gid=1000,file_mode=0666,dir_mode=0777,noserverino,rw,iocharset=utf8 0 0
2. If you do not have the share served all the time or in some cases it is dynamically available then use this shell script instead to mount it:
#!/bin/sh
mount -t cifs //192.168.x.x/hostdir /opt/clientdir -o username=hostuser,password=hostuserpass,uid=1000,gid=1000,file_mode=0666,dir_mode=0777,noserverino,rw,iocharset=utf8



Popular posts from this blog

Shrink Vmware Workstation Ubuntu guest's VMDK file size physically on Windows host

I will be short on the topic as you too only seeking the resolution to the problem in the title. This tutorial is based on using Vmware Workstation 11 on Windows 8.1 host using an Ubuntu 14.04 guest. Note : you have to have the vmware tools, client additions installed on the quest machine! First go to the Vmware client's terminal when you are ready to shrink it down and type: sudo vmware-toolbox-cmd disk list This will give you the mount points that can be shrinked individually. For me I will only go with shrinking the main disk with "/" (root). First lets wipe the free space clean so the shrinker will know what is free to get rid of: sudo vmware-toolbox-cmd disk wipe / To shrink: sudo vmware-toolbox-cmd disk shrink / That's it, after the process in my case I've had a 4.4G file shrinked down to 1.7G, which is much closer to what the client OS saw (1.5G).

Byobu automated window setup

I am recently working all day in a multiple virtual machine environment and became very tired of typing repetitive commands. The most irritating was to always recreate the default Byobu (with tmux ) window setups, running the initial servers in them, etc. So I have asked the question on ServerFault . As a result I have created my 6+ window Byobu automator script and live happily ever since |^_^| Here is a small GIST example for a simple, non-splitting window setup:

Login to Ubuntu with Yubikey

DISCLAIMER: I am by no means responsible for anyone using this tutorial to lock herself out of their system, nor for any damage, data loss, etc. You get the idea, use this at your own risk. With that out of the way, let's get to the fun part. This tutorial will outline the steps I used in my current Xubuntu (Ubuntu with Xfce) 16.04 to enable my Yubikey as a hardware key as a requirement to log in. I am using the default eCryptFS encryption method to encrypt a private folder (not my home folder) which also keeps unlocking when my user logs in. This process worked on my Arch desktop too, which I took from this genius post: https://blog.jamesthebard.net/archlinux-and-u2f-login/ Big thanks and credit to him! This tutorial will be mostly copy-paste, though I wish to do it with the Ubuntu specifics. The login manager I am using is LightDM , I also removed the screensaver that comes with Xubuntu out of the box. On Arch I was able to use GDM with success.