Monday 22 July 2013

Centos connect to windows sharing folder

[dbaroot@linux ~]$ sudo -s
[sudo] password for dbaroot:
[root@linux dbaroot]# yum install samba samba-client cifs-utils
Loaded plugins: fastestmirror, security
Determining fastest mirrors
 * base:
ftp.cs.pu.edu.tw
 * extras: ftp.cs.pu.edu.tw
 * updates: ftp.cs.pu.edu.tw
base                                                                                                                                                      | 3.7 kB     00:00
extras                                                                                                                                                    | 3.4 kB     00:00
updates                                                                                                                                                   | 3.4 kB     00:00
updates/primary_db                                                                                                                                        | 3.8 MB     00:03
Setting up Install Process
Package samba-client-3.6.9-151.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.6.9-151.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
=================================================================================================================================================================================
 Package                                 Arch                                     Version                                           Repository                              Size
=================================================================================================================================================================================
Installing:
 samba                                   x86_64                                   3.6.9-151.el6                                     base                                   5.0 M

Transaction Summary
=================================================================================================================================================================================
Install       1 Package(s)

Total download size: 5.0 M
Installed size: 18 M
Is this ok [y/N]: y
Downloading Packages:
samba-3.6.9-151.el6.x86_64.rpm                                                                                                                            | 5.0 MB     00:04
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : samba-3.6.9-151.el6.x86_64                                                                                                                                    1/1
  Verifying  : samba-3.6.9-151.el6.x86_64                                                                                                                                    1/1

Installed:
  samba.x86_64 0:3.6.9-151.el6

Complete!
[root@linux dbaroot]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@linux dbaroot]# vi /etc/hosts
[root@linux dbaroot]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
\\100.170.1.123\db_backups storage.test.com storage # add this new line to /etc/hosts
[root@linux dbaroot]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sde3             152G  3.3G  141G   3% /
/dev/mapper/mpathc    197G  469M  187G   1% /mnt/mysql

[root@linux dbaroot]# mkdir /mnt/storage
[root@linux dbaroot]# vi /etc/fstab;
[root@linux dbaroot]# cat /etc/fstab;

#
# /etc/fstab
# Created by anaconda on Thu Jun 13 02:35:31 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=880a3cb6-0655-4e17-873b-c60a2e5c6cad /                       ext4    defaults        1 1
UUID=4e412c25-bad4-4cf0-b1fc-e3bc393cfacc /boot                   ext4    defaults        1 2
UUID=405ad5ac-ea7f-4451-834b-43db33ff4d38 /data                   ext4    defaults        1 2
UUID=989614ce-fa27-4c2b-a271-997e1bace4fd swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/mapper/mpathc      /mnt/mysql              ext4    defaults        0 0
//storage\db_backups /mnt/storage cifs exec,credentials=/etc/cifspw 0 0 #add this line to /etc/fstab
[root@linux dbaroot]# chmod 600 /etc/cifspw
[root@linux mnt]# vi /etc/cifspw   #create a password file including share folder login user and password
username=dbbakup_user
password=backup_password
[root@linux mnt]# mount /mnt/storage

[root@linux mnt]# cd storage
[root@linux storage]# mkdir 100.10.88.68
[root@linux storage]# ls -la
total 1
drwxrwxrwx. 2 1036 users    0 Jul 23 12:24 100.10.88.68

No comments:

Post a Comment