General :: Automating SFTP In Bash With Password?
Jul 13, 2010
I wrote a script ages ago to automate an FTP transfer. This was easy as within the script you can specify the password with password <whatever>. Now I am wanting to do a similar thing with SFTP (SSH). I know that SFTP works differently and I cannot specify the password within the script - what do I need to do on the server I am connecting to to either "trust" the host I am connecting from or to somehow specify the password for "sftp user@some_host"? It's IP address will always be the same.
View 4 Replies
ADVERTISEMENT
Dec 5, 2010
Server A: Generated RSA Key
Server B: Added the RSA Key to authorized_keys list
SFTP from A to B.
Still prompts for password.
I will be sftp-ing both from Server B to Server A and 'A to B'. Sever B to Server A works fine. No prompting for password. But from A-B it this is what is happening sftp -v log...
debug1: Offering public key: ~InfAdmin-.ssh-id_rsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Trying private key: ~InfAdmin-.ssh-id_dsa
debug1: Next authentication method: password
InfAdminATServerB's password:
Why is this trying id_dsa private key? From Server B to Server A when I do the same, it does not say 'Trying Private Key -id_dsa' This is what it says
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
How do I enforce that Server A does the same? Why is it trying the dsa private key when I have used RSA.
View 4 Replies
View Related
Oct 7, 2010
upload a file to a business partner of ours in another country. Currently they have an SFTP server set up for us that I am using to download a daily generated file from a previous requirement. I use a bash script to download it since its fairly simple.
Quote:
sftp username@address/filename_filedate.zip /home/user/filedirectory > /var/log/joblog
(removed private info) To satisfy the new requirement I have been trying to write something similar to this;
Quote:
sftp /home/user/filedirectory/filename_filedate.zip username@address:/remotedirectory/
sftps manual page only gives a hint about using a batchfile, however i still cannot get it to work. Does anyone know another way? Or if you can even suggest another method or application? It seems like a bit of a cop out you can EASILY download using the sftp command but can't upload.
EDIT - forgot to mention I have already got keyless entry set up using ssh keys.
View 1 Replies
View Related
Mar 22, 2011
I have configured the SFTP Jail for some of the users in my sftp server and which is hosted for my clients.i have one small issues and i need the help from experts. e /../jajil/etc/shadow file. can you please help me how to update the password in /../jail/etc/shadow file instead of updating in /etc/shadow file.
View 3 Replies
View Related
Mar 25, 2011
how I can do a ftp connection putting the user and passwd as default?
View 6 Replies
View Related
Jul 30, 2010
I am a bash newbie, and am writing a bash script that will allow transfer of files between two computers. BTW, is there a more secure alternative to scp? Currently, I am doing this manually, by using scp. The remote server always prompts me for the password, and I supply that. I want to automate this (hence the bash script). However, I dont want to supply my password in plain text (or if at all - I was under the impression that open SSL does away with passwords and uses certificates etc?).
how I can automate my current process, without explicitly displaying my password. I am running on Ubuntu 10.0.4
View 1 Replies
View Related
Aug 22, 2010
I'm basically setting up two sshfs mounts and I have it set up so I run one command but type my password twice.Is there an easy to way to input a password using bash and pass that variable to another process asking for a password?
View 5 Replies
View Related
Aug 28, 2010
When I use the scp command, here is a command prompt "Input password:",Now I want to use a one line command to perform the scp command.I tested the "echo "password" | scp xxx yu@10.xxx.xxx.xxx:/", but failed.
View 2 Replies
View Related
Jul 24, 2011
As a Windows user, I generated a pair of DSA keys from CoreFTP Lite and sent it to a third party that runs an SFTP server. They told me that a valid DSA key needs to have ssh-dsa at the start and the username@systemname at the end. CoreFTP generated neither the ssh-dsa header nor the username@systemname footer. I tried with WinSCP and it didn't generate them either. Is there a difference between how SFTP works between Windows and Linux? If I put a useraccount@systemname at the end of the text will it work? How would the Linux system validate that my system is called "systemname"? If it can't validate, what is the purpose of adding it?
View 2 Replies
View Related
Jan 10, 2011
This is an old question asked many times, which, however, is NEVER answered directly in any manual I've checked. So...I'm writing a bash install script (instead of a rpm or .deb package) that must be run by a normal user. change to superuser (asking for password and receiving it) and the rest of the script to be executed in the superuser mode in order to install what I mean to install.I know how `sudo ...` or `su `root"..."` or `gnome-terminal -e ...` can achieve this purpose by creating certain batch files and then give them as argument to these commands. That's NOT what I'm asking, however.I want to know how I can make the script interactively switch to superuser mode and go on running the rest of the script (can be a lot of code) in that mode. I don't mind if it oens a separate terminal window to do that; just how can that be achieved?
View 8 Replies
View Related
Jul 29, 2010
For a certain task, everytime I have to open 10 bash terminals and write different commands on them. Any way to automate this? I am running Fedora linux.
View 2 Replies
View Related
Feb 14, 2011
I have a bash script that I am using for doing tape backups. The meat of the bash script is
sudo tar --totals -H pax -cvf /dev/st0 *
This all works just fine.
But of course tape functions have to be ran as root, therefore sudo, requiring the standard user to enter the root password. I would like to be in a situation where the standard user does not need (does not know) the root password. I think my solution is add that standard user.
User named dog to the sudo list.
I have reviewed the sudo man page and looked at [URL]. I am still fuzzy.
1- Will adding user 'dog' to this sudo list do what I expect meaning I can run:
sudo tar --totals -H pax -cvf /dev/st0 *
and the user is not queried for the root password
2- How do I do that? and do I make a cmd alais for only: "tar --totals -H pax -cvf /dev/st0 *"
My distro is OpenSuse.
View 17 Replies
View Related
Jul 30, 2010
I want to automate the following manual process.Currently, I am encryptying a set of files using openssl as follows:Encrypt file.txt to file.out using 256-bit AES in CBC mode $ openssl enc -aes-256-cbc -salt -in file1 -out file1.enI am then prompted for a password, which is then used to encrypt the fileWhen decrypting, I type $ openssl enc -d -aes-256-cbc -infile1.enc -out fileI am then prompted for the password - which again, I manually type.I want to automate this process of en/decryption - so I need to find a way of providing openssh with the password.
My first thought is whether it is possible to read the password from a file (say)? Or is there a better way of doing this?Also, I suppose that I will have to place restriction on who can view the password file - otherwise, that defeats the whole objective of using a password. I am thinking to run the bash script as a specific user, and then give only that user read rights to the contents of that file.Is this the way its done - or is there a better way?Ofcourse all of this leads to yet another question - which is, how to run a bash script as another user - without having to type the user pwd at the terminal.
View 1 Replies
View Related
Jan 10, 2011
I am a student at DeVry University, newly introduced to Fedora and Linux in general, and have a project whereby, we have been asked to consider some administrative tasks that we could automate via a script.I was wondering if there were any thoughts or directives from the community on what admin tasks you guys find to be of inestimable use in automating via a Linux script.
I am new to the Linux commands but have done a wee bit of programming before in C++ and others.I have also done basic DOS batch files before.
View 5 Replies
View Related
Mar 31, 2011
Need help in doing a tedious thing and no idea how to achieve this. The thing I am after is Makefile which generates after ./configure script runs successfully. Now the thing is when we run the `configure` script it may get stuck because of lots of reasons like needs mandatory options to pass with configure, library/header file is missing, etc. So I want to automate this problems as far as I can. As I am not installing the package so apt-get/yum won't hold here for me. So what should be your suggestions on achieving this. Should I study the configure script and the sample Makefile's inside the package
View 4 Replies
View Related
Apr 13, 2011
i have a vsftpd server running well but i want to make/force all users to use sftp and not just ftp is this possible?
View 1 Replies
View Related
Jun 10, 2010
I need to copy all subdirectories and files from one directory to another ever 5 minutes or so, with the old data automatically being overwritten with the new data. I'd also like this to run at startup. Is there any way this can be done? If so, what program would I need to schedule the automation and what is the command line I would need.
View 2 Replies
View Related
Jan 26, 2011
I have tried to automate the configuration of a usb drive with not much success.
The problem that I have is that I have a large amount of usb drives that have a partition table of type "loop" and I need to change them to "msdos". The size of the drives vary and I need to use FAT32 or FAT16 file system.
I've tried various partitioning commands and gui applications but cant find one that I can give a one line command to to set the partition table, maximum partition size and file system.
View 9 Replies
View Related
Nov 20, 2010
I have two cryptsetup volumes with the same password that I want to open in a bash script, and I want to avoid writing the passphrase twice. I was thinking of using read -s. Is there any security problems with this?The other alternative would be to have a password file on a small partition encrypted with a passphrase. Then only give the passphrase and let the script open up all encrypted volumes using the password file. However this seems overly complicated. But is it more secure?
View 3 Replies
View Related
Jul 21, 2011
I have no idea how to make a bash script but I'm trying. My bash script goes something like this:
#/bin/bash
sudo mkdir /media/5gb
sudo mount /dev/sdc3 /media/5gb
I made it executable, put in /usr/local/bin and updatedb. Then I made a launcher pointing to the bash script. The problem is, If I use the launcher, it never asks for your admin password so, the folder doesn't get created.
View 2 Replies
View Related
Nov 15, 2010
Is it possible to use SFTP in yum. As per my company policies ftp,vsftp are disabled in my server.Googled the same but didnt get any valid points
View 4 Replies
View Related
Sep 15, 2014
Whats the bash script for like, how synaptic package manager runs ..
When you run synaptic it ask for root password ..
How do I do this in bash script?
View 5 Replies
View Related
Jan 10, 2011
The situation is the following:I download everyday several files from a website which are always password-protected with one out of 4 or 5 different passwords.I wanted to write a bash script to extract them automatically by trying with the different passwords.The files are mostly 7z.Can anbody lend me a hand?The starting point could be sth. like:
Code:
#!/bin/bash -x
FILE=$1
[code]....
View 8 Replies
View Related
Apr 25, 2010
I'm trying to get a password in a bash script for mysql user creation. But sometimes a get a non-alphanumeric character(s) in the password, and mysql failes with that. I tryed with apg -EO0Il1`~!@#$%^&*()_+-=[];./{}|:"'<>? but failed. I tryed with sed 's/[^a-zA-Z2-9]//g' , but at that moment the minimum password lenght failed. I'm also fine when there is a better alternative then apg.
View 2 Replies
View Related
Aug 9, 2010
I'm trying to write a script that will prompt the user for a username/password, then create that user/password in the right groups on all my machines. I know this is kind of a long way around to avoid a NIS server, but I like making my life more difficult.
This is what I have so far:
Code:
the script has 2 problems: The "if" functions return an error and do not compare the strings successfully. whatever password is entered does get applied properly and the user is unable to login
View 7 Replies
View Related
Feb 7, 2011
What are the advantages of sftp over ftp?
View 4 Replies
View Related
Nov 24, 2010
Trying to sftp (get) a file, and am getting the following message:
spawn sftp -oPort=10022 jn000JN@sftp.section111.cms.hhs.gov Connecting to sftp.section111.cms.hhs.gov... The authenticity of host 'sftp.section111.cms.hhs.gov (204.76.173.42)' can't be established. DSA key fingerprint is 66:64:07:cc:39:89:56:2b:3b:4c:fd:cc:3d:2a:7a:9c. Are you sure you want to continue connecting (yes/no)?
Is this an issue with keys? Where are the keys on a sftp client stored? I am running this sftp script from a different directoy than normal if that matters.
View 3 Replies
View Related
Dec 9, 2010
I use Evolution Mail Client everyday on my fedora machine. It has become indispensable somewhat. I am wondering if Evolution can be made to run in the background without the GUI, so it can check mails (IMAP/POP) and post delivery reminders through notify-send. I don't mean evolution-notify-alarm ... I know evolution-notify-alarm runs like that but I think that is limited to calender events and tasks (using data mostly stored locally)
I find that I get notified via notify-send interface only when Evolution GUI is on or minimized. Is there a way to get a real background version of this activity - the GUI can then appear when the Panel Icon is clicked
View 4 Replies
View Related
Mar 26, 2011
I can't sftp directly into a particular host. To move a file from my home machine to the host, I must sftp a file to an intermediate host; ssh into the intermediate host; and sftp the file to the final destination. Is it possible to avoid such madness?
View 5 Replies
View Related
Aug 9, 2011
I run a linux file server for my office and we user SFTP for remote partners to login and download files. Is there a way to see if there are any active connections or logins so I can know when it is safe to perform maintenance on the machine?
Since the machine is almost constantly serving large files, scheduled maintenance is often bumped off due to someone either upload
View 2 Replies
View Related