Pages

Saturday, May 28, 2011

Commandline to samba mount linux to a windows share

I've had challenges with in the past getting a mount to work.  The following seems to work without any special consideration in the windows share.  This is especially good because it forces the linux folder to use the user and group so not special consideration is required in apache.

NOTE: /sbin/mount.cifs is a linux command, not a custom shell script.

This is mounting a windows shared folder named "project" to "/var/www/html/project".  The files in linux will all be 666 and the folders in linux will all be 777.  You can customize this.

/sbin/mount.cifs //{YOUR WIN IP ADDRESS}/project /var/www/html/project -o 'uid={YOUR LINUX USERNAME},gid=apache,sockopt="TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192",dir_mod=0777,file_mode=0666,noperm'

Put this in a shell script or an alias and it is quick, easy, and reliable.

No comments:

Post a Comment