Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
The "sudo" command is used to launch a program as the root user. Most likely you need to be a member of the "wheel" group to use sudo on any command. Sudo looks up whether you have permission to run a command as root by reading the /etc/sudoers file. That file should be well commented including possible an example to mount a cdrom. You may just need to uncomment that example. You could use that example to add another entry for the "eject" command as well.
To edit the /etc/sudoers file, run the "visudo" command as root. This adds error correction. If you make an error, it gives you an opportunity to fix the error or bail out altogether.
The "unhide" option is sometimes needed for some old CD discs where a part of the filesystem is marked as hidden. It may not be necessary, and it has never made a difference for me.
There is another option that is very handy. Especially for mounting removable HDs such as pen drives or external USB drives. The "noauto" that I may have mentioned already prevents a non-connected device from stalling the boot process. That entry is passed over when "mount -a" is run. The "user" and "users" option allow a regular user to mount a filesystem without needing to do so as root. For a usb FAT32 pen drives you could have the options "user,uid=<yourusername>,gid=<yourgroup>,fmask=0117,dmask=0007. The "user" option in /etc/fstab for that device will allow a normal user to mount that drive. The uid & gid options set the owner and group. The fmask and dmask option set the permissions of directories to rwxrwx--- and files to rw-rw----. If an external drive has a linux filesystem on it, chown, chgrp & chmod would be used on the mounted directory instead. This works best by using the LABEL or filesystem UUID instead of the device name in the /etc/fstab entry.
While any user could mount the device, if the fs_uuid or label of the external drive matched an entry, it would be mounted with your ownership permissions and another user on your system would not be able to cd into it if you didn't set "other" permissions allowing it.
If the external drive is normally connected, you could have a mount command in your ~/.bash_login or ~/.bash_profile script. You could have an /etc/fstab entry for an nfs or samba share as well allowing you to mount it without using "su" or "sudo". ( An nfs share could be mounted at bootup instead. The ownership of the remote filesystem would determine the ownership. )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.