Use a script or configuration file to enforce password prompts during boot.
Use a script or configuration file to enforce password prompts during boot.
Hello, I understand your situation. You're using a CentOS-based FTP server (vsftpd) inside a virtual machine and want a reliable way to run a specific command at every system boot. You mentioned placing it in /etc/rc.d/rc.local but encountered issues because the command needs password authentication each time it runs. You’re looking for a permanent solution, ideally embedding the password directly into the command so it doesn’t require re-authentication after each reboot. I’m happy to help you explore options.
You're asking about modifying the command with username and password parameters. The "username=user" option would likely be needed if the command already includes a user@IP_address part. Using a file to store credentials could also be a viable approach. Your idea seems reasonable, and I'm here to help you explore it further. Let me know! Thank you for your question!
On Stack Exchange you discovered sshpass and followed these steps: copy the file, set permissions, and mount it with the command.
You don't need a password. Generate an SSH key so you can mount it from /etc/fstab without typing your password. Run ssh-keygen -t rsa -b 2048. Your home folder should now contain an id_rsa.pub file. On the remote server, use ssh-copy-id to add the key. Then include the mount command in /etc/fstab based on your CentOS version.
I followed exactly what you instructed. Instead of modifying /etc/fstab, I placed the change in /etc/rc.d/rc.local, and it resolved the issue perfectly. Your help made it work! Thank you all for your support—this thread is now closed.