I would like to automate the connection to an SFTP server (FileZilla) in order to create a batch file to automate some reporting processes.
What I used until now is the following script:
sftp alessandro:arica.123#85.148.385.22
Theoretically, I am passing in the script above the username (alessandro), the password (arica) and the hostname. The problem is that the password is not passed as a parameter, therefore in order to connect, I am asked to enter the password in the terminal.
Can you explain me and tell me what I am doing wrong?
Can you explain me and tell me what I am doing wrong?
The manual page for sftp explain synopsis of sftp command this way (abbreviated):
sftp [...] [user#]host
As you can see, there is no :password so both of username:password are passed as a username to the server. sftp command does NOT accept passwords on command-line, because it is very bad security practice to store the passwords in plain text in scripts.
You should configure your server to accept public key authentication (it is not so hard and very useful for automation!):
ssh-keygen -t rsa -f ~/.ssh/id_rsa
ssh-copy-id alessandro#85.148.385.22 # write password once
ssh alessandro#85.148.385.22 # will not ask for password again
Related
Would like to create a batch file to connect linux server using PUTTY using port number and also without port number. Please let me know the code for it to connect the server by clicking the batch file.
Read: Putty's manual and find Answer A.6.5
You can load Putty session, provide username, password, port and lot of other options. It is well described in docs.
Try this:
putty [-P port] user#machine
So I'm trying to transfer files to a remote computer on an SSH system. 'I've used the sftp command, used lls to confirm the presence of the file in the local computer, and then implemented the put filename command. However, I receive the same result each time:
stat filename: No such file or directory
I just don't know what's going wrong! Any help or troubleshooting tips would be appreciated.
If you're currently using Windows you can download winscp and use that to transfer files. It has a nice graphic interface that is easy to interact with
Well, supposing that you are on a Linux/Unix environment, you could use scp. Typically, the syntax for an scp command would be like this:
$ scp foobar.txt your_username#remotehost.net:/some/remote/directory
The above command copies the file foobar.txt which resides in the local computer, to a specific directory in the remote machine, using a username (you will be asked for a password later).
The sftp command line client uses the ssh transport and will tunnel your connections using your key. So if you have ssh access, you should also have sftp access. This is a secure option for people who are more comfortable with ftp. Most GUI ftp clients should also support sftp.
I was facing also in this issue when trying to upload files from the local to the remote server. I did commands well and clean but the mistake I was making was that: I've logged into the remote server with ssh and then login with sftp. In that way, sftp will consider that your remote server is the local (as I logged in first to this via ssh) when using the command below:
put /c/path/to/file.txt
So, the thing to do is to login directly to the server via sftp and putting your local files in there.
I need to make a batch file which opens my ftp server automatically,How do i automatically input user name and password to the ftp username and password prompt.I have tried to use
echo username|ftp ipadress,but it is taking the input for both user name and password. So I need help to create a batch file, which automatically logins as "user" and password "pass"
Before you use the following script, please remember that the FTP protocol
doesn't allow encryptions, the authentication process and the data transitions.
Create a new text file with the following text:
open "myservername/serverip"
"%username%"
"password"
cd /upload
bin
hash
put/get "filename.cab"
bye
Note: Please choose the correct ftp commands to allow the script to work.
Save the file as runftp.txt (For example).
Run the command: c:\windows\system32\ftp.exe -s:runftp.txt
SOURCE: http://support.microsoft.com/kb/555976
in windows operating systems we can use ftp commands in file as parameters to ftp.exe as following:
ftp -s:filename
The parameters filename can contain password, username .... and other obvious commands.
is there alternative way or any other ftp tool can accept encrypted parameter file.(at least encrypted for username and password) to hide connection info from clients.
now I am going to generate temp parameter filename (plain text) in code,
then execute ftp -s:filename
finally delete the filename.
however is there any tool could accept encrypted connection presetting file?
Postgresql is not cooperating. I did a yum of postgresql and postgresql-server and that seemed to be fine. I then tried to `` and it gives and error message:
createdb: could not connect to database postgres: FATAL: Ident
authentication failed for user "postgres"
If I remove the user it gives the same error just with my username. I'm on a Centos OS. I want it to work with apache and php after I figure out to create a database.
When I run /usr/bin/postgres it gives an error:
/usr/bin/postgres does not know where to find the server configuration
file. You must specify the --config-file or -D invocation option or
set the PGDATA environment variable.
Can't figure it out. Did I miss a configuration step? I thought doing yum would work out of the box.
Sounds like it is configured for ident authentication which requires you to login as the linux user postgres ie:
su postgres
and then run the createdb command. Other method would be to locate your pg_hba.conf probably in something like /var/lib/pgsql/9.1/data and switch to trust authentication. That way you can connect using -U postgres with any linux account and it will let you in without verifying the password. Then you can setup required usernames and passwords and then switch to something more secure like md5.