1

I want to use keychain for SSH cron jobs.
I've found this good answer.

I've add command keychain --nogui id_rsa in .profile
And when I reboot and login I have to enter password.

But I don't see any password prompt when .profile executes.
I can create stand-alone bash script with the command and place it in Start-up Applications. But I'm not sure this way is good.

Where the right place for this command with keychain password prompt?

Dimetry
  • 247

1 Answers1

2

~/.bash_profile, ~/.bashrc, or ~/.profile get executed when you open up a terminal window, not when you log in to a desktop.

If you want to do this system wide for ALL users create a .desktop file in /etc/xdg/autostart/. Example:

[Desktop Entry]
Type=Application
Name=A custom Script
Exec=sudo /sbin/my_custom_script.sh
Icon=system-run
X-GNOME-Autostart-enabled=true

and create a script.sh with your command in it. That also makes sure they can not permanently remove your desktop file. If you want this for 1 user put the script in ~/.config/autostart/ and change the Exec line to Exec=~/bin/acustomscript.sh

Rinzwind
  • 309,379