Setup autofs » Historie » Version 1
Jeremias Keihsler, 12.01.2017 09:38
1 | 1 | Jeremias Keihsler | h1. Install AutoFS-support |
---|---|---|---|
2 | |||
3 | h2. Requirements |
||
4 | |||
5 | To install AutoFS you will need the following: |
||
6 | * a installed and supported operating system (e.g. CentOS 6.x) |
||
7 | * root-access |
||
8 | * a fast internet connection |
||
9 | |||
10 | h2. Preliminary Note |
||
11 | |||
12 | this is based on http://www.olivetalks.com/2008/02/21/automatic-backup-of-windows-computers-using-linux/ |
||
13 | |||
14 | Before setting up autofs we need to create a network share on the Windows PC. Remember the user and the password since we’ll need them later on. In this article I’m going to assume the user name is backup and the password is secret but you should use something more difficult to guess depending on your security requirements. I’m also assuming the Windows domain is called company. |
||
15 | |||
16 | h2. Install |
||
17 | |||
18 | Install AutoFS by logging into a Terminal as root: |
||
19 | <pre><code class="bash"> |
||
20 | yum install autofs |
||
21 | </code></pre> |
||
22 | |||
23 | h2. Setup |
||
24 | |||
25 | You need to edit @/etc/auto.master@ file and add this line |
||
26 | |||
27 | <pre><code class="bash"> |
||
28 | /smb /etc/auto.windows --timeout=60 |
||
29 | </code></pre> |
||
30 | |||
31 | Then you create the file @/etc/auto.windows@ containing the following, in a single line: |
||
32 | |||
33 | <pre><code class="bash"> |
||
34 | <share> -fstype=smbfs,credentials=/etc/auto.windows.<credentials pre>,uid=<user>,gid=<group>,fmask=0755,dmask=0755 ://<windows PC>/<network share> |
||
35 | </code></pre> |
||
36 | This must be written on a single line, with no separating spaces starting from @-fstype@ to @dmask=0755@ |
||
37 | |||
38 | @<share>@ is the name of directory where you want to mount the network share from Windows PC. |
||
39 | |||
40 | @/etc/auto.windows.<credentials pre>@ is the name of file where you store the user name and password needed to access the network share on Windows PC. In our case it will look like this: |
||
41 | |||
42 | <pre><code class="bash"> |
||
43 | username = backup |
||
44 | password = secret |
||
45 | domain = company |
||
46 | </code></pre> |
||
47 | |||
48 | h2. Test |
||
49 | |||
50 | After these preparations it’s time to tell the autofs daemon about these changes by executing @service autofs reload@ or a corresponding command. You should be able now to see that the network share gets automatically mounted when you execute @ls /smb/<share>@. After 60 seconds the share will be unmounted. |