How do I set HDD to automount

Questions specific to the KDE DE go here
Fargo
Posts: 896
Joined: 17 Sep 2013 14:40

How do I set HDD to automount

Postby Fargo » 29 Mar 2016 16:21

I recently installed a 2nd hard drive that I want to use to back up my system to on a regular basis. How do I set up the hard drive to mount automatically. The way it is now I have to type in my password every time I want to view the hard drive.

I will be using Lucky Backup to perform auto backups.

User avatar
ilu
Posts: 2474
Joined: 09 Oct 2013 12:45

Re: How do I set HDD to automount

Postby ilu » 29 Mar 2016 16:32

Since you want to use it for backup, I would advise against automounting. If malware ever strikes your system - and it can! - it will be able to reach everything that is mounted with user rights. Think ransomware - its really spreading atm because it's such a succesful business model. The necessity to enter a password is a security measure you should not circumvent. The general recommendation even is that the backup medium should be physically removed from the system after backup.

That being said, if you want automount, you'll have to add it to /etc/fstab. Find yourpartitions UUID with:

Code: Select all

sudo blkid
Create a subdirectory in your home directory called "backup". Then open /etc/fstab with root privileges in your editor of choice and add a line that could look something like this

Code: Select all

# /dev/sdb1
UUID=40bfb8cb-dc0d-4097-9320-a2d4fb92a73a	/home/your -user-name/backup	ext4	defaults	0	0
Reboot.

Fargo
Posts: 896
Joined: 17 Sep 2013 14:40

Re: How do I set HDD to automount

Postby Fargo » 29 Mar 2016 17:11

Thanks for you thoughts. I'll consider not having it automount. I'll have to see if their is a way for Lucky Backup to mount it to do the backup. That might be preferable if I can do it that way.

User avatar
ilu
Posts: 2474
Joined: 09 Oct 2013 12:45

Re: How do I set HDD to automount

Postby ilu » 29 Mar 2016 22:41

Please post back if you find a solution with Luckybackup. I'd be interested.

kurotsugi
Posts: 2226
Joined: 09 Jan 2014 00:17

Re: How do I set HDD to automount

Postby kurotsugi » 30 Mar 2016 03:54

I assume we are discussing about a non removable HDD, not usb stick nor a portable HDD. in that case the risk mentioned above doesn't applied here. you can safely add the entry to fstab.

User avatar
ilu
Posts: 2474
Joined: 09 Oct 2013 12:45

Re: How do I set HDD to automount

Postby ilu » 30 Mar 2016 04:22

kurotsugi wrote:I assume we are discussing about a non removable HDD, not usb stick nor a portable HDD. in that case the risk mentioned above doesn't applied here. you can safely add the entry to fstab.
Well, mounting through fstab is not really a problem - permanent access with user privileges is. If he uses the HDD for backup these rules do apply. Every data accessible with user rights is at risk. Even file servers get infected as several institutions learned the hard way. And an infected (= encrypted) backup is worth zero.
Don't just rely on Linux not beeing a target. It's technically possible, has already been tried (though diletantic) and sooner or later will be done successfully.

kurotsugi
Posts: 2226
Joined: 09 Jan 2014 00:17

Re: How do I set HDD to automount

Postby kurotsugi » 30 Mar 2016 10:50

i think you've read too much windows's horror story. linux automount is different from windows's. if you ever wonder why did we have lot of directory under root (/) directory (why did they didn't put everything under one 'system' directory), that's because linux is designed to work with multiple HDD. it have been done even long before linux exist (it actually was inherited from UNIX). consequently this design is also used in android, ios, mac, and every other non-windows OS . no one ever said this design is insecure.

the automount horror story only happened in another world called 'windows'.

User avatar
Zill
Posts: 1850
Joined: 13 Aug 2013 14:28
Location: Lincolnshire, UK

Re: How do I set HDD to automount

Postby Zill » 30 Mar 2016 14:32

ilu wrote:... Don't just rely on Linux not beeing a target. It's technically possible, has already been tried (though diletantic) and sooner or later will be done successfully.
Maybe so - but by then I am likely to have won three lottery jackpots! ;-)

IMHO, using /etc/fstab to mount static HDDs on boot is the correct way of doing things on a Linux system. Automount (autofs) is available but this is generally used to mount remote systems connected via a network such as NFS. However, such automounting is not for security reasons but because the remote system may not necessarily be running when the local system boots up.

Fargo
Posts: 896
Joined: 17 Sep 2013 14:40

Re: How do I set HDD to automount

Postby Fargo » 30 Mar 2016 17:55

Yes, I am talking about an internal hard drive I am using for nightly backups. I haven't change my fstab yet. You got me thinking about different options.

I've noticed that if you go to 'Applications>System', Luckybackup has a super user version that can be run by the normal user. When starting super user mode, you can also set it to remember your password so it will start just like any other program. So doing that I can start lucky backup with super user privledges. Now that lucky backup is running as su, I just need it to mount and unmount the drive for backup. It just so happens that lucky backup also includes an 'advanced' options menu. Within that menu there is an 'also execute' tab, which gives the option to run commands before and after lucky backup runs. I think if I have the proper command to mount the drive, I should be able to enter that command into the command box and have lucky backup mount the drive before backup and un mount it after backup.

If anyone has time. Please look at that 'Also Execute' tab for me to see if that can do what I want. Thank you

User avatar
Zill
Posts: 1850
Joined: 13 Aug 2013 14:28
Location: Lincolnshire, UK

Re: How do I set HDD to automount

Postby Zill » 30 Mar 2016 19:31

Fargo: I run luckyBackup as super-user and use the Scheduling option to run a cron job every night. As this is unattended, I use "Console-mode" so that no password is required.
Console-mode

Check this box if you wish this schedule to be executed in command-line mode.
Use this if there is no graphical environment available at your system (eg server).
Also use this option if there is a graphical environment available but you wish not to grant permission, to the user that runs luckybackup, to use it. This is almost always true for the super-user.
My backups go to a different system on my LAN via NFS and so this is, effectively, automounted as I use autofs. However, if you did wish to mount and unmount another (local) HDD, or another system, directly from luckyBackup then I cannot see any reason why the "Also Execute" tab would not enable this.

User avatar
MAYBL8
Posts: 1487
Joined: 10 Mar 2013 18:41
Location: Maryland Heights, MO USA
Contact:

Re: How do I set HDD to automount

Postby MAYBL8 » 31 Jul 2016 12:07

My backups go to a different system on my LAN via NFS and so this is, effectively, automounted as I use autofs. However, if you did wish to mount and unmount another (local) HDD, or another system, directly from luckyBackup then I cannot see any reason why the "Also Execute" tab would not enable this.
Zill,
Could you help me with a similar setup that I am doing. I have a SolydK server I am using for my website hobby and it is a Mail server and Music Server. I have hooked up some external HDD to it and want to use them as backup drives for my desktop I use for everyday use. I have been unable to get easy access to the external drives on the server (not knowing what I am doing). I have tried messing with Samba but i can't seem to get authentication correct.
I have tinkered with AutoFS but can't get that correct either.
I would like to have the external hard drives accessible to all my systems on my LAN (Windows computers and LInux computers.)
Let me know if you can help.
Thanks
Dan
P.S. I am back on the forum and back with SolydK64 EE after a brief try with Ubuntu testing. I kind of liked some of the Ubuntu features however my wireless was giving me fits that I couldn't fix so I am back.


User avatar
Zill
Posts: 1850
Joined: 13 Aug 2013 14:28
Location: Lincolnshire, UK

Re: How do I set HDD to automount

Postby Zill » 31 Jul 2016 14:05

MAYBL8: Well, I will do my best here but I don't run either SolydK, external HDDs, Samba or have any Windows machines on my LAN. :-(

I have only Linux machines on my LAN (running SolydX, LMDE2 and Crunchbang) and so I use NFS, rather than Samba, to share the fixed HDDs on the machines.

Hopefully, someone else should be able to help with your Samba configuration but, when you get this working so that your machines can see each other with appropriate Read/Write permissions), then I suggest you could take a look at the guide I originally used to set up my mounts with autofs:
Mounting NFS File Systems using autofs

First, install package autofs.

Autofs uses the automount daemon to manage your mount points by only mounting them dynamically when they are accessed.

Autofs consults the master map configuration file /etc/auto.master to determine which mount points are defined. It then starts an automount process with the appropriate parameters for each mount point. Each line in the master map defines a mount point and a separate map file that defines the file systems to be mounted under this mount point. For example, the /etc/auto.misc file might define mount points in the /misc directory; this relationship would be defined in the /etc/auto.master file.

Each entry in auto.master has three fields. The first field is the mount point. The second field is the location of the map file, and the third field is optional. The third field can contain information such as a timeout value.

For example, to mount the directory /proj52 on the remote machine penguin.example.net at the mount point /misc/myproject on your machine, add the following line to auto.master:

/misc /etc/auto.misc --timeout 60

Next, add the following line to /etc/auto.misc:

myproject -rw,soft,intr,rsize=8192,wsize=8192 penguin.example.net:/proj52

The first field in /etc/auto.misc is the name of the /misc subdirectory. This directory is created dynamically by automount. It should not actually exist on the client machine. The second field contains mount options such as rw for read and write access. The third field is the location of the NFS export including the hostname and directory.

The directory /misc must exist on the local file system. There should be no subdirectories in /misc on the local file system.

To start the autofs service, at a shell prompt, type the following command:

sudo service autofs restart

=================================
Note that "ghost" option in /etc/auto.master is required to show unmounted directories.

=================================
There is also some info from "RitterSport" in this thread about sharing files with CIFS (the Microsoft system), rather than NFS.

p.s. Welcome back after going AWOL ;-)


Return to “KDE specific (SolydK)”

Who is online

Users browsing this forum: No registered users and 2 guests