Legit
CopyLeft© | Darmanex Weblog - A journey about virtual world.
2008 - 2018
Powered by Blogger
April 20, 2018

Accessing windows file sharing in Linux

darmanex | 2:21 PM
Well, my Dev team mate have a Linux server for build some projects, and they wanted to access their files from Linux by remote/konsole mode, in this case their files are on Windows. So, here are their files sharing on Windows system.
As you can see above, we will access on those folder Autogenerated and Resources. So, here's the step to make it accessible from Linux.
Installing a requirements packages
# apt-get install cifs-utils

After that then go to /etc/nsswitch.conf and edit it:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

add "wins" on that line
hosts:  files mdns4_minimal [NOTFOUND=return] wins dns mdns4

If winbind is not installed on Linux system, please install it by this issue command:
# apt-get install libnss-winbind winbind

Now reload the network to take effect:
# service networking restart

Mounting drive
Backup the fstab configuration to avoid any mistaken in the future.
# cp /etc/fstab{,.old}

Now create a credential user files who will accessing the folder share files on current linux user.
# printf '%s\n' 'username=darm' 'password=******' > .smbuser

Next, we should know the UID and GID on the system. Run the following command
# id programmer
uid=1000(programmer) gid=1000(programmer) groups=1000(programmer),27(sudo),7001(wksadmin)

Create folder for mounting point.
# mkdir /media/prg
# mkdir /media/prg2

Then we open fstab file to start mounting point, and put this line on it.
//Workstation/AutoGenerated /media/prg cifs credentials=/home/programmer/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0
//Workstation/Resources /media/prg2 cifs credentials=/home/programmer/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

Save your configuration, and reload the fstab
# mount -a

Now let's take a look the result. :D

0 comments:

Post a Comment

Please leave a comment and do not give a spam! Comments that smells of spam will be deleted without prior notice