Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to enter a password in script [SOLVED]

Featured Replies

i'm setting up an rsync script, where the first command prompt's a request for the destination source's password. Ideally the script would enter the password for the rsync to run. but how exactly do i write that into the script (or is there another way?) i have no problem running this in terminal manually where i can type the password in, it looks like this:

rsync -avhP --progress /source/file/path [email protected]:/destination/file/path
[email protected]'s password: 

so writing the script, what should the entry to fill the password look like here?

#!/bin/bash

echo "Starting File Server Backup"
echo "This May Take a While"

#Backup and Sync local file server
rsync -avhP --progress /source/file/path [email protected]:/destination/file/path
[email protected]'s password: <-- what should i enter on this line?

 

Edited by Cpt. Chaz

  • Community Expert

Best way is to use SSH Key-Based Authentication so no password is needed.

  • Author

even with vpn already set up between the machines?

  • Author
3 minutes ago, JoeUnraidUser said:

Try adding "<<<password" to the end of the command:


rsync -avhP --progress /source/file/path root@192.168.1.X:/destination/file/path <<<password

Change "password" to your password.

No dice. i've also tried variations of read and echo | sudo from write-ups in other forums with no luck either.

 

i've also read warnings of putting passwords in scripts, but all i'm dealing with here are two of my personal private networks over vpn. no exposure from the inside or outside, so i'm not worried about it from a security standpoint. 

  • Community Expert
17 minutes ago, Cpt. Chaz said:

even with vpn already set up between the machines?

Yes, AFAIK not easy (or even possible) to enter the ssh password with a script

  • Author

alright, i'll go the ssh key route then. thanks

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.