F5F Stay Refreshed Software Operating Systems Use a script or configuration file to enforce password prompts during boot.

Use a script or configuration file to enforce password prompts during boot.

Use a script or configuration file to enforce password prompts during boot.

B
57
09-16-2023, 07:42 PM
#1
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.
B
baileygirl2003
09-16-2023, 07:42 PM #1

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.

D
Darkeos
Senior Member
538
09-24-2023, 04:52 AM
#2
Yes, you can store the password in a file and use it with that command.
D
Darkeos
09-24-2023, 04:52 AM #2

Yes, you can store the password in a file and use it with that command.

J
JuliBr0
Senior Member
495
10-01-2023, 01:47 PM
#3
I believe you'll need sshpass, but I'm not sure about the exact setup. To install it, you should use; yum install sshpass Edited November 28, 2017 by wkdpaul
J
JuliBr0
10-01-2023, 01:47 PM #3

I believe you'll need sshpass, but I'm not sure about the exact setup. To install it, you should use; yum install sshpass Edited November 28, 2017 by wkdpaul

I
iJedi007
Member
157
10-19-2023, 09:00 AM
#4
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!
I
iJedi007
10-19-2023, 09:00 AM #4

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!

M
minifig_cd
Member
168
10-19-2023, 10:53 AM
#5
On Stack Exchange you discovered sshpass and followed these steps: copy the file, set permissions, and mount it with the command.
M
minifig_cd
10-19-2023, 10:53 AM #5

On Stack Exchange you discovered sshpass and followed these steps: copy the file, set permissions, and mount it with the command.

J
JolyStNick
Junior Member
16
10-26-2023, 12:18 PM
#6
Sure, that sounds good!
J
JolyStNick
10-26-2023, 12:18 PM #6

Sure, that sounds good!

L
levoyageur92
Posting Freak
807
10-26-2023, 06:44 PM
#7
Thanks again! I'll attempt it tomorrow when I return to work.
L
levoyageur92
10-26-2023, 06:44 PM #7

Thanks again! I'll attempt it tomorrow when I return to work.

I
ImaAnimal
Member
97
10-30-2023, 10:48 AM
#8
Scripts could also prove useful...
I
ImaAnimal
10-30-2023, 10:48 AM #8

Scripts could also prove useful...

B
Bonnibel
Posting Freak
794
10-30-2023, 12:29 PM
#9
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.
B
Bonnibel
10-30-2023, 12:29 PM #9

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.

R
Redstoner137
Posting Freak
811
10-31-2023, 05:41 PM
#10
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.
R
Redstoner137
10-31-2023, 05:41 PM #10

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.