Skip to content

Map a Directory to a Windows Share

Tutorial to mount a shared drive from a Windows system on a CentOS Linux server.

Logged in as root, at the Linux terminal prompt type:

Terminal window
yum install samba-client cifs-utils

Logged in as root, at the Linux terminal prompt enter the following commands, replacing the items below with your settings:

user = Windows user
password = Windows password
192.168.0.48 = Windows IP or host
share = Name of the share on Windows
media = Directory on the Linux system where the share will be mounted

Terminal window
echo username=usuário > /root/.credencial
echo password=senha >> /root/.credencial
echo //192.168.0.48/unidade /media cifs vers=2.0,credentials=/root/.credencial 0 0 >> /etc/fstab

The commands above will create the file /root/.credencial which will securely contain the user credentials for the Windows share and will add a configuration line to the /etc/fstab file, causing that share to be mounted automatically whenever the Linux server is restarted.

To mount the share, at the command line type:

Terminal window
mount /media