Can I use a scp to download a file using shell script - unix

Can I automate a download of a file from a system using scp(by entering the user id/password) and manipulate the file and upload it to the same place. If you have any idea of using scp in a shell script, pls do let me know
Thanks

Scp is ordinary command line uility in linux so it might be used directly. See this page for examples.

Yes you can automate that from a shell script pretty easily, but the question that remains is whether you want to input the password manually everytime you run the script or use ssh keys to accomplish authentication and achieve full automation.
Check this tutorial on using SCP.

use ssh-copy-id [the command varies by distro, but on Ubuntu it is ssh-copy-id]. here's how:
ssh-copy-id ~/.ssh/id_rsa.pub me#mysite.com this will install your public key to the remote host. it will not ask for your password if you do this! If you have no ~/.ssh/id_rsa.pub, then run ssh-keygen and accept all the default options [just press enter when it prompts for input].

Related

How to copy file from desktop to unix using ssh terminal command

I am trying to copy a file called TEST.txt from my desktop to Unix server using SSH client. What command would I use to accomplish this task?
Many thanks!!
You need to use scp, like so:
scp /file/to/send username#remote:/where/to/put
Take a look here for more help: https://unix.stackexchange.com/questions/188285/how-to-copy-a-file-from-a-remote-server-to-a-local-machine
I assume you are running a Windows desktop. You can use the SFTP tool in PuTTy or FileZilla to copy files using your ssh credentials.

Script runs in Unix but not in Informatica command task

My script ran successfully in Unix but not in a command task of an Informatica workflow. The permissions are fine, and the parameter file and variables have been declared in the workflow. Why is this happening?
Make sure that the machine you are running informatica on, is running in a unix box.
If it is on a windows machine, you will have to run the DOS equivalent command for your script.
Check whether informatica repository is pointing to same UNIX server, in which the script to executed from informatica is present.
I to faced same situation ,please check the propertied of script file make it as 755(CHMOD),It should work.
Regards
Rama
This could be a permission issue. If you are executing a shell command from Informatica, right click the file in SFTP and click on "Properties" (I am using Winscp).Give full permission to the file and now it should work.

Issues while using script (typescript) command with rksh restricted ksh

I have a scenario where I want to log every activity for a particular user. I have a script built around the script command which I invoke from the user's .profile. Now the requirement is that the user should not be able to delete the subsequent typescript file that is created. Towards that, I've created a user with the default shell of rksh and put a restriction on commands that can wipe the file out. But the problem is that when I login with that user, if I call the script with the script command, the forked shell is always sh and not rksh. I know that if SHELL is not set, then the forked shell will be /bin/sh by default, but I have SHELL setup properly. How do I ensure that the forked shell is rksh only?
If I comment out the call to the logger from .profile, then I get a rksh shell. But even then if I manually issue the script command, it launches sh. Any help will be appreciated.
Thank you,

Example SFTP batch upload script for AS400 server to upload to a Unix SFTP server

Suppose I have a file called helloworld.txt on an AS400 and I want to write a script to automate the daily upload of the source file helloworld.txt on an AS400 server to upload to a Unix SFTP server, say sftp://exampleunixsftp.com?
Does someone have such a script? Is OpenSSH the only tool that can be used on the AS400 to get this accomplished or are there any other methods? If LFTP could be installed on the AS400, that would be an easy solution but since it's only for Unix/Linux/Win/Mac then I don't have this option. I read Scott Klement's article at:
http://systeminetwork.com/article/ssh-scp-and-sftp-tools-openssh
I just need an example basic script to get this done. I'd appreciate this.
The MidrangeWiki topic on SSH has some information and examples that may be helpful.
sftp is intended primarily as an interactive utility. scp performs the same function non-interactively.
The command, once authentication is set up, would simply be:
scp helloworld.txt username#exampleunixsftp.com:<destination path>
LFTP can be installed with some preparation in the PASE environment. See Open Source Binaries. Currently offline. Use the Google cache.

how to use windows bash script to open a website with my username and password

I like to write a windows bash script, test.bat to open a website, say www.test.com and provide my username and password at the same time.
you can use autohotkey (http://www.autohotkey.com/) to create a script to open website and enter your username/password. You can call the script from a .bat file (or even from bash). I did not understand why you want to use bash on windows.
AutoIt is an easy to write scripting language that would be great for this.

Resources