Hide Password Ftp With The Same User

Hi
I must connect to ftp to get some files occasionally. To do these I make a script.
The problem is that the user is generic and all of my work use these user in the local host, and the remote machine I must connect with my personal user so they can see my password in the script
There is some way to avoid these?
Thanks and sorry for my English


Similar Content



How To Copy File From Remote Host To Local Host Then Delete From Remote Host

I have an expect script to SSH to a remote host and obtain some user inputs and information about the server/network configuration. The responses are saved in a text file that I then need to copy to my local host so that I can read the lines into variables for use in the parent shell script.

Is there a way to do this without needing to enter the username and password for the local host to use function scp? I have tried the following in my expect script to no avail:
Code:
spawn scp $usr@$host:$flnm .
expect {
	-re "(.*)assword:" { 
		send -s "$pswd\r"
	}
}

I have also tried to directly scp the file and enter the username and password to try to debug the issue, and that doesn't work either:
Code:
spawn scp file.txt user@host:file.txt
expect {
	-re "(.*)assword:" {
		send -s "password\r"
	}
	"you sure you want to continue connecting" {
		send -s "yes\r"
		exp_continue
	}
}

In both scenarios I have used exp_internal 1, and there are no errors. But I do not end up with the file on my local host.

Following the copy, I would like to delete the file from the remote host. Any suggestions on how to accomplish this?

Ssh And Adding Users In Multiple Users

In our environment i have to ssh to each an every servers
ssh <hostname> then which prompts for password for every login
i have to create a user name on 30 severs manually it takes much time so need a script to do this task i have googled and found some for loop scripts but it did not fullfill the requirement.
First i have to check whether the users exists and not and later add the user or reset the password for user using script

How To Return From Shell 'read' Command Passed In Expect Script?

I have a shell script that calls an expect script I wrote to ssh login to another host and get user input regarding that host's network configuration. I pass four arguments to the expect script: the remote host ip address, the username, the password, and the list of commands to run. My expect script is below:

#!/usr/bin/expect
# Usage: expectssh <host> <ssh user> <ssh password> <script>

set timeout 60
set prompt "(%|#|\\$) $"
set commands [lindex $argv 3];

spawn ssh [lindex $argv 1]@[lindex $argv 0]

expect {
"*assword:" {
send -- "[lindex $argv 2]\r"
expect -re "$prompt"
send -- "$commands\r"
}

"you sure you want to continue connecting" {
send -- "yes\r"
expect "*assword:"
send -- "[lindex $argv 2]\r"
expect -re "$prompt"
send -- "$commands\r"
}

timeout {
exit }

expect -re $prompt
send -- "exit\r"
}

The script runs well, except that if I send a command such as 'read' that requires user input, the script does not continue or exit after the user presses enter. It just hangs.

The commands I pass to the expect script and it's call are as follows:
SCRIPT='hostname > response.txt;netstat -rn;read net_card?"What is the network interface card number? " >> response.txt; read net_mask?"What is the subnet mask? " >> response.txt'

/usr/bin/expect ./expectssh.exp $hostip $usr $pswd "$SCRIPT"

Any suggestions on how I can pass a command to my expect script that requires user input without it hanging?

On a side note because I know it will come up - I am not allowed to do key-based automatic SSH login. I have to prompt for a username and password, which is done from my main shell script.

Thanks for any suggestions and help you can provide!

Setting Root Password

Wow, I got my new Linux pc yesterday and it's very very fast. It's faster than my new MacBook.
So I go to the user account which also says administrator so I'm presuming that's the root owner?????? and I typed in my name and changed the password. The guy who sold it to me named the password user and the computer user. Yet when I go to the terminal my username and computer is still called user@user
How do I change the root password and computer name?

Setting Root Password

Wow, I got my new Linux pc yesterday and it's very very fast. It's faster than my new MacBook.
So I go to the user account which also says administrator so I'm presuming that's the root owner?????? and I typed in my name and changed the password. The guy who sold it to me named the password user and the computer user. Yet when I go to the terminal my username and computer is still called user@user
How do I change the root password and computer name?

Bash User Input With Static Value Validation

So I created this big script and want to ask for username and set a variable, however if the username exist in the username variable then continue with script otherwise ask the user to enter his name.

Flow:
-- start script "Enter User Name"
-- ask user to input username
-- if username is blank or different value then put that username in $USERNAME variable
-- then continue with the rest of the script

-- next time this user runs the script it will have his name loaded so he just presses enter to continue with the script.

-- If it is NOT the same user then, new user can erase existing input and enter a new name.

Hope it makes sense...

Thanks in advance for the help.

Become A Root Wiht Public Key Access

Hello Everyone,

I have a question about how to give sudo privileges to a user that log in via public key without password.

I created a normal user and I added this user to the "visudo" folder with ALL privileges.

when the user is logged in the system via public key and the user wants to become a root, a password is requested but i don't want to type the password.

Also to add the public key to the root it is not possible because i track the user log in in the system and if they log via root i cannot do that.

Thank you in advance.

Changing Password To A User

Hi
When i tried to change the password for a particular user as a root by using usermod command I didn't see any error at that time.But later when I tried to login again it is not accepting the new password as well as old password.Why its happening?Any help....

Ftp: Connect: No Route To Host

I have two VM's on a Redhat 7 Base machine and installed Redhat 6 on both machnies. Trying to use FTP. I can ping both each other.
VSFTPD is installed,
firewall is enabled.
vsftpd.conf is also updated for anonymous user login.
I could login using anonymous user.
while uploading file
I am getting a message as ftp: connect: no route to host

Script

user="john bob randy susan"
I extracted local user list as: cat /etc/passwd | cut -d ":" -f1

Now I need to write a script to find the difference in user between these two (users defined as above and local user). I tried many ways its not working. Any help

#!/bin/bash
users="john bob randy susan"
luser=`/bin/cat /etc/passwd | cut -d ":" -f1`
......
....


Thank you