ftp and user/password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ftp and user/password
# 1  
Old 02-06-2008
ftp and user/password

I know the typical way to script automate an ftp session is to pass all of the commands to ftp, with something 'like' the following:
echo USER $user
echo PASS $pass

My question concerns other methods or tricks people have used so that the username and ESPECIALLY the password are not embedded in the script. Some ideas are:
(a) reading password from a separate file; theink $cat...
(b) getting selected data from a file for password; think $cut...

So, what are some other tricks for having a $pass variable I can send for login purposes, but still maintain a greater level of security for the password (then having it embedded in the script)?

Thanks for the ideas. The actual code is not required, more just the methodologies for accomplishing this.
# 2  
Old 02-06-2008
if u're using windows, you can pick up username pwd from another file using the -s option. I belv this option does not exist in any unix flavor, in which case u can create a unix user created for ftp-ing the files, and u can set the password as an env variable in the .profile, of course keeping the appropriate access levels to .profile
# 3  
Old 02-06-2008
If you are using a unix, try .netrc
You specify a hostname and pair it with a username and password. Several implementations of ftp and telnet (including the default ones that come with solaris) understand these files.
# 4  
Old 02-06-2008
And you might want to try switching to sftp if that is available.
With it you can use either userid/passwords, or key files.
Use openssh for the unix end, and winscp for the windows end, both are open source.
# 5  
Old 02-06-2008
Error

Quote:
Originally Posted by ag79
...in which case u can create a unix user created for ftp-ing the files, and u can set the password as an env variable in the .profile, of course keeping the appropriate access levels to .profile
One should be careful storing sensitive information in the environment as it's available to anyone via the BSD implementation of ps (the -e flag). A very common mistake, one doozy of a security hole Smilie
# 6  
Old 02-06-2008
MySQL

Quote:
Originally Posted by jgt
And you might want to try switching to sftp if that is available.
With it you can use either userid/passwords, or key files.
Use openssh for the unix end, and winscp for the windows end, both are open source.
What he said. scp / sftp would be way better than ftp if you can do it. Public keys make this sort of thing much easier.
# 7  
Old 02-07-2008
Power thanks for some of the ideas...

I will think about the suggestions.

It appears the ideas are related to 'when I control ftp'. However, I often need to pick up data from a site I do not control, but are given the username & password to authenticate. Therefore, when automating, the password must come from somewhere to be sent.

I was thinking of:
(a) Creating a script to store username & passwords to a 'text' file, but in a jumbled sort of way. For instance, username=joe & pasword=hi; so since joe is the 10th, 15th and 5th letters of alphabet, I could add the numbers 10+15+5=30. I would then write my file as
"joekdjfiekcnt9230gh7a6cfbn8snh86i"
start with username "joe", then skip to the 30th position to get the first character of password "h", skip two and read the "i", and be at end of line.
{There are lots of algorithms I could choose.}
(b) Then, my ftp scripts could call the related program to retrieve the info from the stored text file.
(c) Perhaps I could make my 'retrieval password' script protected so that it can only be executed by users, but not able to be read?

I could then logon to someone else's ftp site without embedding the username and password in the ftp script. Further, even if someone stumbled upon or knew of the text username-password file, they wouldn't necessarily know the logic to pull apart the text to learn the valid passwords.

Not perfect, but maybe an approach to reading a separate file for username/password pairs so that they are not embedded in the user scripts. Something a programmer could hack, but the general user, even if he/she printed out the script being run, would not see the username and password for the actions.


So... this is the direction of my thinking and what I am also searching for insight on from others.

Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Get ftp without password

Dear Masters, I usually run bash to get file from ftp using command below (user : nobody, password : guest) #!/bin/bash cd /xx/xy/prog FILE="list_country.xls" /usr/bin/ftp -in 1.2.116.12 << END user nobody guest ascii cd /XYZ/ABC binary get $FILE quit END But in this case,... (9 Replies)
Discussion started by: radius
9 Replies

2. Shell Programming and Scripting

How to scp File from root user in one server to say crt user in another server and avoid password?

Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies

3. Shell Programming and Scripting

How to setup a password less ftp??

hi, i want to setup a password less FTP to a remote server so that i can ftp to a remote server without the password. i have setup a passwordless ssh and i am able to use scp commands to connect to the remote server without asking for the password. but when i try to ftp to the same remote... (6 Replies)
Discussion started by: Little
6 Replies

4. Shell Programming and Scripting

Automated FTP without plaintext user/password in script

hi , i am a still beginner in unix and specially in ftp i've written this script but my admin asked me that he don't want to see in my ftp neither user neither password , so i've created .netrc file where in it i've put machine name , user and pass but still included in my script , so if someone... (19 Replies)
Discussion started by: semaan
19 Replies

5. UNIX for Advanced & Expert Users

password verification verify password of a user for only first 8 characters

Helo , I m using linux pam library for user and its password authentication. I m creating new user and giving its password.I m giving password of 10 characters.now when I login in as that newly created user its ask me $ su - ram Password: You are required to change your password immediately... (12 Replies)
Discussion started by: amitpansuria
12 Replies

6. UNIX for Dummies Questions & Answers

Can an FTP user change their own password?

If we set up FTP only users who can't log in with a shell (/bin/false type of shell) and set them up with a default password, like abc123 or something not secure, is there any way for the user to change their own password once they get on the system? (2 Replies)
Discussion started by: LordJezo
2 Replies

7. UNIX for Advanced & Expert Users

setting username and password for ftp

hi, i have set up an FTP server in one of our systems. could some one tell me the procedure to set up the username and password for it to enable other users to access the server. thanks (1 Reply)
Discussion started by: div
1 Replies

8. UNIX for Dummies Questions & Answers

Ftp account change password

How can I change the password from an ftp user account on a ssh server? Please give me simple instructions for a users who hasn't a lot of experience. :D Just the words in form of a list thanks a lot. (1 Reply)
Discussion started by: m.seidenberg
1 Replies

9. UNIX for Dummies Questions & Answers

ftp password issue

I think I may have put this in the wrong forum earlier the script that follows is an extract from a post someone gave as an answer to a question on ftp within a script /usr/bin/ftp ftpsiteaddress <<END verbose on bin user username password cd <directoryname> put <filename> mput... (3 Replies)
Discussion started by: Henrik
3 Replies
Login or Register to Ask a Question