I have the below line in a script. When I run it, it prompts for a password to copy files in the server. I need the password to be taken from the script.  for i in cat forwarders do scp -o StrictHostKeyChecking=no $filename $tarfile badgeid@$i:/tmp; done
45545
I need to login to a user that I've created on a remote host running Ubuntu. I can't use an ssh key because the ssh login will happen from a bash script ran within a server that I won't have access to (think continuous integration server like Bamboo).   I understand this isn't an ideal practice, but I want to either set the remote host to not ask for the password or be able to login with something like ssh --passsword foobar user@host, kind of like MySQL allows you to do for logins.   I'm not finding this in man ssh and  I'm open to any alternatives to getting around this issue.
83952
Data   I want operator users on this machine to mount their own cifs shares The sudoers file already contains the /bin/mount -t cifs //*/* /media/* -o username=* command for all operators I want the users to mount a cifs share through a script typing the password only once, not twice. The sudo password and the cifs password are identical.   What I already have  This script works:  #!/bin/bash sudo 'mount -t cifs //192.168.1.1/home /media/$USER/home -o username=$USER'   ...but it requires the users to type the same password twice!     Once for sudo Once for the mount itself   This would also work:  #!/bin/bash echo -n Password:  read -s szPassword echo $szPassword | sudo -S sh -c 'echo $szPassword | mount -t cifs //192.168.1.1/home /media/$USER/home -o username=$USER'   ...but this would require me to allow all operator users to be able to sudo sh (major security problem)  Question  How to mount a cifs share in bash¹ without putting sh in the sudoers file nor creating a permanent/temporary file???  Note 1: no python, perl, C, Go, ... please? Note 2: I know I can just remove the password through the sudoers file, but I'm trying to tighten security, not loosen it, without giving up convenience...
104062
Below is an image of the process I took to create a user on bash in Linux.    I understand that the password shouldn't be displayed for security purposes, but what I mean is, why do asterisks (or the characters I entered) not appear?
51706
For some reason, I have a server that if ssh into another server...you don't need to enter the  password.  How is this done? Can someone give me step by step instructions please?
85084
I'm trying to do the following but it's not quite right.  cat ~/Desktop/blah.png | ssh -t -t trusktr@50.116.4.56 "cat | sudo -i 'cat | /path/to/blah.png'"   I have my public ssh key in the trusktr@50.116.4.56 user's .ssh folder, so no initial password is needed. When the sudo -i command finally starts, it prompts me for the root password, but immediately fails as if I had pressed enter but I didn't even touch the keyboard. I have a feeling maybe the cat command is being catted into the password prompt. The output looks like this:  trusktr@LENOVO-PC ~ $ cat ~/Desktop/win-8.1-missing-lockscreen-setting.png | ssh -t -t trusktr@50.116.4.56 "cat | sudo -i 'cat &gt; /srv/http/default/htdocs/~/img/win-8.1-missing-lockscreen-setting.png'" tcgetattr: Not a character device [sudo] password for root: You type like i drive. [sudo] password for root: Your mind just hasn't been the same since the electro-shock, has it? [sudo] password for root: Maybe if you used more than just two fingers... sudo: 3 incorrect password attempts Connection to 50.116.4.56 closed.   I don't have direct ssh access through the root user, only through a normal user with access to sudo using the root password.  How might I cat the image through ssh, through the non-root user, into the root location all in a single command?
112070
I'm setting up a server for backing up my desktop box remotely. I want to prevent remote password access to the server, permitting only users with private keys (AKA my desktop box) to access it. How can I block remote password access while allowing physical password access to the server?
30890
describes how to SSH into a machine that can only be accessed through one or more hosts (that can also be SSH'd into).  Is there an equivalent way of using scp? That is, copy a file to my local machine from the far machine (assuming I have password or key access to all machines along the way)?
79088
I am writing a batch file to execute some other programs. In this case I need to prompt for a password. Do I have any way to mask the input text? I don't need to print ******* characters instead of input characters. Linux's Password prompt behavior (Print nothing while typing) is enough.     @echo off SET /P variable=Password :  echo %variable% Pause   This will read the input but I can't mask the text using this approach.
20110
I have an expect script that connects to a few routers through ssh.  All these routers have the same password (I know, it's wrong), and the script needs to know that password in order to be able to connect to the routers.  Currently, the password is passed to my script as an argument on the command line, but this means that there's a trace of that password in my .bash_history file as well as in the running processes.  So instead I would like the user to be prompted for a password, if possible silently.  Do you know whether or not it's possible to prompt the user for a password with expect?  Thank you.  Edit: if I was connecting to servers instead of routers, I would probably use ssh keys instead of passwords.  But the routers I'm using just support passwords.
113391
I am using Mac OS X 10.9.4, following is my script to copy files from local machine to different host  #!/bin/bash #!/usr/bin/expect  echo "I will fail if you give junk values!!" echo " " echo "Enter file name: " read filePath echo " " echo "Where you want to copy?" echo "Enter" echo "1. if Host1" echo "2. if Host2" echo "3. if Host3" read choice echo " " if [ $choice -eq "1" ] then   spawn scp filePath uname@host1:/usr/tmp      expect "password"      send "MyPassword\r"   interact elif [ $choice -eq "2" ] then   spawn scp filePath uname@host2:/usr/tmp      expect "password"      send "MyPassword\r"   interact elif [ $choice -eq "3" ] then   spawn scp filePath uname@host3:/usr/tmp      expect "password"      send "MyPassword\r"   interact else   echo "Wrong input" fi   when running this script i am getting following  ./rcopy.sh: line 21: spawn: command not found couldn't read file "password": no such file or directory ./rcopy.sh: line 23: send: command not found ./rcopy.sh: line 24: interact: command not found
121312
I'm trying to run the command ssh -o StrictHostKeyChecking=no but I'm a bit lost as to how to run it. I've tried running it from a shell script, but the output was the man page or settings that lists out all the parameters.   I then tried running that command from the shell (Cygwin) itself, but got the same man output. How do I run the command? Do I need to provide credentials or anything?
63786
I'm using a GNU/Linux system remotely, via SSH.  I mistakenly added something into my $HOME/.bash_profile scriot which causes an error. (To be specific: I added an exec foo command instead of . foo, applied to another bash script without execution permissions, which results in an error.)   Now I can't seem to SSH, SCP or SFTP into my machine: bash, my login shell, tries to run the exec foo command, gets the error and throws me out! I don't have any other account I can access remotely.  Is there something I can do to restore access to the system?  Additional details:   Most ports other than for SSH are unavailable since the machine is behind a firewall. It's a Devuan 3 ASCII (~= Debian 10 Beowulf) system.
107108
I am trying to achieve a scenario where I need to  SSH to ABC server from XYZ server. Public keys will set up already to smooth password less login. Now i just want to exit from script if found that  SSH command prompts for password. It means  public key are not set up.  ssh -o ConnectTimeout=10 user@ABC &lt;&lt;HERE ----- doing some stuff here---- HERE   Ouput-  Password:   Script resides on XYZ. I am running it from XYZ and trying to SSH ABC. If it prompts for password then exit from script by printing a message.
5800
It's driving me nuts! I just want to transfer one simple file from laptop to server.  I'm using ubuntu on both machines.  So I have:  -rwxr-xr-x 1 sandro    414622 2011-10-14 23:42 sandrophoto-html.tar.gz   And I'm sending it using:  sudo scp -P XXXX sandrophoto-html.tar.gz usern@server.local:/media/xx/xx/xx   And I get: scp: /media/xx/xx/xx/sandrophoto-html.tar.gz: Permission denied  p.s. I might be doing this other way around - I want to send file tar.gz that is located on my desktop, to remote server into the folder /media/yadayda
27138
Is it possible to do this:  ssh user@socket command /path/to/file/on/local/machine   That is to say, I want to execute a remote command using a local file in one step, without first using scp to copy the file.
116000
I wrote a simple shell script to dump a specific mysql database. problem is it is prompting me for a password even though I provide on. The mysql db is version 5.0.27 if that matters. Here is the specific line I am using.  $MYSQLDUMP -u backup -p$MyPass $DB &gt; $DEST/$FILE   I tried several variations, but to no avail.
86678
I have a Param block in my script   Param (     [Parameter(Mandatory=$True)]     [string]$FileLocation,      [Parameter(Mandatory=$True)]     [string]$password = Read-Host "Type the password you would like to set all the users to" -assecurestring )   Can I use the Read-Host CmdLet in a required Parameter field? if not what can I do to make sure I take in the correct type of variable type so I can pass it to a user creation process?