SSHFS is a file system for mounting directories over SSH (Secure Shell—a network protocol), and fstab is a configuration file that contains information of all partitions and storage device in a computer. SSHFS is Linux based software that can be installed on Ubuntu and Debian through apt-get. The file, fstab is located under /etc, and /etc/fstab is the full path to this file. /etc/fstab contains information about where your partitions and storage devices should be mounted and how.
Computer users often ask the following questions: Why is SSHFS always asking for a password in fstab? Users often get confused when SSHFS ask for a password in fstab, because they do not want to use password for SSHFS. Users need to create a public/private SSH keys if they want to enter an SSHFS mount in fstab, and does not want to use password for that. It will also allow users to protect files, and users will also have to copy the public key on the mount point.
There are computer users in the world who say: SSH works fine when they type, SSH firstname.lastname@example.org. However, the process asks them for the password when they type, sudo sshfs email@example.com:/home/raspberry/Videos /home/pi/LinuxMintMountedFolder/ -o all. It happens because SSHFS looks for in the root directory for the necessary keys. They can solve this problem by copying the files id_rsa and id_rsa.pub from their hidden home folder to SSH folder i.e., cp /home/pi/.ssh/id_rsa /root/.ssh/ and cp /home/pi/.ssh/id_rsa.pub /root/.ssh/. They can then type: sudo sshfs firstname.lastname@example.org:/home/raspberry/Videos /home/pi/LinuxMintMountedFolder/ -0 all.
Computer users can mount SSHFS without public key by using the password_stdin option, but not with fstab. Using public key is a better choice for users; however, public key does not work some time. Script file should contain a password, and users have to make sure that only root has permission to the script file.
When some users add a row in fstab and reboot it, then they may see a mounting problem, because it asks them for password. SSH does not allow a password that is stated from the command line. Some users ask: Can they use SSHFS without the requirement of a password? The answer to this question is simply: Yes. Users can definitely use SSHFS without using the password. Users are usually asked to use password for SSHFS; however, there are some commands that can help them to use SSHFS without the need of a password.
Users will find it difficult to mount a directory via SSHFS in fstab, but it is not impossible to mount a directory via SSHFS in fstab. Users can setup passwordless login if they have the required skills for that. Users will need to make a wrapper if they need to pass the identity file to SSH via SSHFS.
SSHFS mount can be done with the SSH key and password. To do this, users have to set uid (user identifier)/gid (group identifier) fields to proper user from local server’s user. The trick to keep the correct uid/gid mapping on both servers is idmap=user. You will have to mount /home/REMOTE_USER/data/ from the remote server in /mnt/data/ on the local server; therefore, you need to make sure to mkdir the local directory /mnt/data as your mount point.
SSHFS mount in /etc/fstab with a SSH key and password can be done if you have programming skills for Linux. SSH private key and sshpass can help you achieve your goal of SSHFS mount. Make sure you set the password. SSHFS mount is a tricky thing, but you can achieve it if you have proper programming skills in Linux. SSH key method is often referred to users for generating SSH key that will be used for authentication, then adding it to the SSH-agent. You would have realized by now that SSHFS mount can either be done with password and without password.
What have understood so far about the SSHFS file system and fstab? SSHFS always asks for password in fstab, and it makes users worry. If you have required technical skills to overcome this problem, then you can easily get out of the trouble of typing password in fstab. The process may seem difficult to you, but it is not impossible. You will have no issue to solve the problem of password for fstab if you are tech-savvy. Technical skills are the keys to achieve solution to the question: Why is SSHFS always asking for a password in fstab? Users simply do not like to use password for SSHFS, and they feel bothered for the process. You should feel relaxed if you want to come out with the solution by thinking hard for the issue of using password for SSHFS in fstab. If you feel relaxed, then you can think positively to come out with the solution to your problem. Hopefully, you can now mount SSHFS either by using password or not using password.
Liza John is a tech-savvy writer. She has professional experience of 5 years in IT field. Mostly, she writes articles about technology and also give assignment help of technical engineering students and She works in software house nowadays where she proudly creates articles about technology.