• Home
  • Insurance
  • Banking
  • Loans
  • Remitance
  • About us
Facebook Twitter Instagram
  • links
Biz Assurance
Subscribe
  • Home
  • Insurance
  • Banking
  • Loans
  • Remitance
  • About us
Biz Assurance
Home»Tech»How to Pass a Password to the SCP Command in Shell Script in Linux Mint 21
Tech

How to Pass a Password to the SCP Command in Shell Script in Linux Mint 21

Alicia CormieBy Alicia CormieNo Comments2 Mins Read
Facebook Twitter WhatsApp
Share
Facebook Twitter LinkedIn WhatsApp

“SCP stands for secure copy and is a Linux command used for copying the desired files and directories securely from one location to another. However, at times while using this command, the users face authentication issues. The target location, i.e., the location that is supposed to receive the file, might have password authentication enabled, and to access that location, you need to provide that password. Therefore, this guide will show you how to pass a password to the SCP command in a shell script in Linux Mint 21.”

Method of Passing a Password to the SCP Command in Shell Script in Linux Mint 21

For passing a password to the SCP command within a shell script in Linux Mint 21, you have to proceed as follows:

Step # 1: Downloading the SSHPass Tool on Linux Mint 21

First, you should download the SSHPass tool on your system by running the following command:

$ sudo apt-get install sshpass –y

Step # 2: Passing a Password to the SCP Command in Linux Mint 21

Now, after installing the SSHPass tool on your system, you need to incorporate the line shown below in your specific shell script. You can even execute this command directly within the Linux Mint 21 terminal:

$ sshpass –p “abcd1234” scp file.txt system2@10.0.2.15:/home/system/dir/

Here, “abcd1234” represents the password that we have passed, i.e., the password of the recipient location, “file.txt” is the name of the file that we wish to share, and it is followed by the name and IP address of the remote machine from where we want to share this file and also the path of the local machine where we want to copy this file.

Conclusion

Using the method prescribed in this guide, you can conveniently pass a password to the SCP command directly through the terminal or via a shell script in Linux Mint 21. This way, you can bypass all the potential authentication failures while using this command.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous Article‘Puppy Bowl XIX’ Had Its Biggest Ratings Ever Because, Seriously, It’s Dogs Playing Football, How Do You Lose?
Next Article How to Use FSCK in Linux to Check the File System?

Related Posts

How to Fix “Not connected – No connections are available” Error in Windows

How to Fix “Blurry Font Problem” in Windows 10

How to Fix “Can’t create new folder” in Windows 10

Add A Comment

Leave A Reply Cancel Reply

Grimes Explained Why She’s ‘Purposefully’ Trying To Make Herself ‘Infinitely Less Accessible’

It Appears That Netflix May Have Edited One Of Chris Rock’s Jokes About Will Smith In His Comedy Special

There’s A Rumor That Cardi B And Megan Thee Stallion Want To Remake A Cult-Classic Halle Berry Movie And Cardi Addressed It

The Biggest Takeaways From ‘Bel-Air’ Season 2, Episode 3

  • Homepage
  • Sitemap
© 2023 Biz Assurance - Designed by Curtiex Ventures.

Type above and press Enter to search. Press Esc to cancel.