Sponsored Content
Top Forums Shell Programming and Scripting FTP credentials from a config file Post 302534185 by KenJackson on Monday 27th of June 2011 06:29:09 AM
Old 06-27-2011
If the server is at a known, fixed IP address, you can assign it two names in /etc/hosts like this. Then either name will connect you to the same server.
Code:
192.168.1.21   serverA serverB

Then make a ~/.netrc file with both usernames and passwords. (Of course make sure ~/.netrc has file mode 0600.)
Code:
machine serverA login USERA password PASSA

machine serverB login USERB password PASSB

Then just access whichever server you want. The username and password will be handled automatically.

You may even be able to put macdef init in ~/.netrc for each server to change directories automatically. Though I'm not sure that works for every implementation.
This User Gave Thanks to KenJackson For This Post:
 

10 More Discussions You Might Find Interesting

1. IP Networking

RH 7.2 FTP Server Config

Is it possible to ftp from WinXp to a Linux box? I have the the ftp server set up to take the request from the WinXp box but each time I try to connect I keep getting an error, Connection established, unknown error(windows ftp program) or if I try to ftp from the DOS prompt I get ftp connect:... (3 Replies)
Discussion started by: flounder
3 Replies

2. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

3. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

4. Shell Programming and Scripting

Issues using array credentials to read contents of a file

Hi, I am trying to read the contents of a file using array credentials in unix. The file I am trying to read is tab separated and contains the below contents. # partnerid Direc Server Port Source_Dir Target_Dir Mask Remove Files Passwordless Compare Files ... (3 Replies)
Discussion started by: aartikara
3 Replies

5. Red Hat

Apache virtual host config vs global config problem

Hi folks, I am trying to configure Apache webserver and also a virtual host inside this webserver. For Global server config: /var/www/html/index.html For virtual host config: /var/www/virtual/index.html Both client10 & www10 are pointing to 192.168.122.10 IP address. BUT, MY... (1 Reply)
Discussion started by: freebird8z
1 Replies

6. UNIX for Advanced & Expert Users

Need to pass credentials in one Go

Hi, We usually switch user using the below command. sudo su - user1 It then prompts for the password which we feed in. I wish to pass both the username and the password in one go thus eliminating the prompt for the password. I am using java standalone to connect to unix using... (11 Replies)
Discussion started by: mohtashims
11 Replies

7. AIX

Passing user/pass credentials to automountd map file.

How could I pass credentials to the automountd daemon through it's map files? Tried credentials=/some/file.txt - Didn't work. Tried SHARE.domain.com/user/pass/SHARE_NAME in map file - Didn't work Tried user=USER,pass=PASS - Didn't work. I can see the mounts created but when I access them... (4 Replies)
Discussion started by: Devyn
4 Replies

8. UNIX for Advanced & Expert Users

Passing credentials via .netric file in Linux

How to create netrc file...I searched in google & got to know that we have to create .netrc file in home directory, I've created .netrc file in in home directory created .netrc file in home directory more .netrc machine $HOSTNAME login xxxx password xxxxx Note: echo $HOSTNAME... (2 Replies)
Discussion started by: sam@sam
2 Replies

9. UNIX for Beginners Questions & Answers

How to check via SSH and credentials if file on remote server exists?

Hi there, I am sorry to ask that kind of beginner thing, but all the code I found online didnt work for me. All I want to do is: Check via SSH if a File exists on my webserver. The SSH login has to be with username and password. So I would be very thankful if somebody could write the line.... (8 Replies)
Discussion started by: Jens885544
8 Replies

10. SCO

Config FTP on SCO Like proftpd

i have installed and working FTP Server With SCO 5.05. But i need solve problem related to config, like proftpd (i not have installed proftpd) the recomendation on client site is enable port 113 related to inetd. but i need solve it on server side, like proftpd.conf: DefaultRoot ~... (9 Replies)
Discussion started by: Arcanisgk
9 Replies
ftpconfig(1M)						  System Administration Commands					     ftpconfig(1M)

NAME
ftpconfig - set up anonymous FTP SYNOPSIS
ftpconfig [ftpdir] ftpconfig -d ftpdir DESCRIPTION
The ftpconfig script is executed by the super user to set up anonymous FTP. Anonymous FTP allows users to remotely log on to the FTP server by specifying the user name ftp or anonymous and the user's email address as password. The anonymous users are logged on to the FTP Server and given access to a restricted file area with its own file system root. See chroot(2). The FTP area has its own minimal system files. This command will copy and set up all the components needed to operate an anonymous FTP server, including creating the ftp user account, creating device nodes, copying /usr/lib files, and copying timezone data. The passwd and group files set up have been stripped down to prevent malicious users from finding login names on the server. The anonymous file area will be placed under ftpdir. If the ftp user account already exists, then the current FTP area is used, and the system files in it are updated. All other files are left untouched. This command should be run to update the anonymous FTP area's configuration whenever a system patch is installed, or the system is upgraded. OPTIONS
-d Create a new or update an existing ftpdir without creating or updating the ftp user account. Use this option when creating guest FTP user accounts. OPERANDS
The following operands are supported: ftpdir The absolute pathname of the directory under which the anonymous FTP area is set up. EXIT STATUS
The following exit values are returned: 0 Successful completion 1 Improper usage of the command 2 Command failed ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWftpu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ftpaddhost(1M), in.ftpd(1M), useradd(1M), chroot(2), attributes(5) SunOS 5.10 1 May 2003 ftpconfig(1M)
All times are GMT -4. The time now is 09:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy