Linux Scroll

Just another WordPress.com site

Bash script to mount windows share folder in linux using samba

Bash script to mount windows share folder in linux using samba:

$ mkdir /mnt/smb

$ touch smb.sh
chmod +x smb.sh
$ vi smb.sh

Copy and paste:

#/bin/bash


SERVER_IP="192.168.1.1"
SHARE_NAME="c$"
USERNAME="samba user name"
PASSWD="samba password"
DOMAIN="domain"

mount.cifs //$SERVER_IP/$SHARE_NAME -o username=$USERNAME,password=$PASSWD,dom=$DOMAIN
/mnt/smb/

Run the scrip and open mount folder:

./smb.sh

$ cd /mnt/smb/
Advertisements

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

%d bloggers like this: