Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
that can be done, but normally this is achieved by adding a line to your /etc/fstab, since during bootup all entries in the /etc/fstab that *don't* have the option "noauto" will be mounted.
The line you would want to add would be something like:
However, instead of putting the username and password in this file which is readable by everyone you might do better putting them in a root only readable file, for example /root/.cifs.conf. This file would contain:
Code:
username=admin
password=xxx111
and you would use the following line in your /etc/fstab
you should not need to run a start up script. Instead you should try to debug why it is not being mounted. Have you checked your log files? Does, running it manually work? Eg with root privs:
you should not need to run a start up script. Instead you should try to debug why it is not being mounted. Have you checked your log files? Does, running it manually work? Eg with root privs:
Code:
mount /home/backup/Email
Evo2.
hi evo2, yes running manually works fine. but it's not being done automatically by the fstab.
@JJJCR: If you are able to run mount /home/backup/Email without any errors then the fstab entry itself is good. The mount command used from the command line doesn't have all the options that are needed, so the system will look in the fstab file and use what's there to complete the mount command.
Maybe the fstab order in which things are mounted isn't correct. / (and possibly /home) should be mounted before you try to mount the cifs mount.
hi druuna, thanks for the reply. I can't really try it now even though I wanted to.
The server is on-line, users will jump on me, if I will reboot the server to try.
i'll find a good time to test it out.
The command I used on the fstab is this: //192.168.1.17/Email /home/backup/Email cifs gid=users,file_mode=0664,dir_mode=0775,auto,username=admin,password=xxx111 0 0
hi druuna, thanks for the reply. I can't really try it now even though I wanted to.
The server is on-line, users will jump on me, if I will reboot the server to try.
i'll find a good time to test it out.
Checking the fstab order doesn't interfere with a running server. Just look to make sure that the cifs line comes after the normal mounts (/, /home etc).
Quote:
The command I used on the fstab is this: //192.168.1.17/Email /home/backup/Email cifs gid=users,file_mode=0664,dir_mode=0775,auto,username=admin,password=xxx111 0 0
is there anything i'm missing out on the line?
evo2 already answered that in post #2
BTW: You could use rc.local instead of fstab to mount the share. Add something like this: mount /home/backup/Email
hi druuna, i will test out the rc.local it's a good idea.
Actually, the reason i want to reboot the server because I want to check whether the mounting will be done automatically.
Because sometimes there's a power shutdown on the building, I will just turn on the machine and a few days later I will realize that I have to mount some folders that is needed by the server.
So in order not to miss out this thing, I want it to be done automatically.
Actually, the reason i want to reboot the server because I want to check whether the mounting will be done automatically.
Are you aware of mount's -a option?
mount -a will mount those entries that aren't mounted and do not have the noauto flag. Any new (or unmounted) entry in the fstab file can be mounted this way. However, mount -a doesn't look at the order of the entries.
The above won't replace a reboot, but it will give you a very good indication if the individual(!!) entries are processed correctly.
Quote:
Originally Posted by JJJCR
I did some Googling, would this be right to put on rc.local?
sleep 70 && mount //192.168.1.17/Email /home/backup/Email cifs &
I'm not sure about the sleep part. rc.local is executed after all the rcX.d stuff is done. Maybe you need to wait a bit for things to settle down, maybe not. Experiment if at all possible.
A simpler mount command would do: mount /home/backup/Email &
I do assume that the cifs entry is present in your fstab file (and, as mentioned by you in post #6, mounting from the command line works).
If the cifs entry isn't present in fstab then you need the full blown mount command to be in rc.local, something like this:
Code:
mount -t cifs -o username=admin,password=xxx111 //192.168.1.17/Email /home/backup/Email &
Beware: rc.local is readable by normal users so I would go with evo2's suggestion and store the password and user in a root owned file (say /root/.cifs.conf) and use that instead for security reasons. This command would look like this:
Code:
mount -t cifs -o credentials=/root/.cifs.conf //192.168.1.17/Email /home/backup/Email &
Last edited by druuna; 09-20-2013 at 08:08 AM.
Reason: Fixed typo.
hi druuna, i'm not aware of the mount -a option. Thank you I will try it.
I will give it a shot.
@Evo2, thanks for pointing out the rc.local security that it will be visible to other users.
@Firerat, thanks for pointing out about the network. The mount option is pointing to the NAS.
I wasn't sure whether I turn on first the server, then after that I turn on the NAS.
Yup it could be that the NAS was not yet up when the email server was already up.
The suggesstion of druuna, about the mount -a option i will try that one.
Thank you guys for all your ideas and help. Keep you posted with the result.
Just read your last post,,
didn't realise something might be down ( the NAS )
You could have the @reboot cronjob test if the nas is available and mount,
If not send a WOL to it, sleep a little and test and hopefully mount
have it in an until loop
( until it succeeds or fails too many times )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.