Hi,
I am looking for a simple shell script that allows for sftp to be run from the server to another server (Windows). I would like the script to be passed parameters suchas destination server, Id, password, Directory structure/folder name, file name etc...
Need some help to know how to start with and it would be great if someone help me with any sample sftp shell script
Hello.
I have a shell script, which I am using to access the SMB Client:
Code:
#!/bin/bash
cd /home/username
smbclient //link/to/server$ password -W domain -U username
recurse
prompt
mput baclupfiles
exit
Right now, the script runs, accesses the server, and then asks for a manual input of the commands.
Can someone show me how to get the commands:
Code:
recurse, prompt, mput baclupfiles and exit
to be run by the shell script please?
I am using a shell script named by test.sh, for example containing
Code:
address="$PWD"
echo "$address"
.
If I put it in folder temp1, and run test.sh, then it will give me the address of the current directory. But if I am now in folder temp2, and I want to run test.sh, I always need to copy test.sh to folder temp2, and then run it. Is there a way that I can run test.sh without copying it? I am not root user.
Hi Experts,
Is there a way that i can delete selected directory trees on sftp server. Directory is only getting removed if it is empty. I am able to sftp & scp on the server to transfer the files.
Please help here!
VijayB
Please tell me for shell script..
I m writing the script.
In that script i written the 1 function and in that function i have to write the contents in existing file
so i write,
cat > /etc/puppet/manifests/init.pp
{
ensure => present,
}
.
But it caanot write the changes in ssh machine
so what i can do in my script?
Please help me...
books say that PATH variable contains the locations where the shell searches the commands to execute them.
I created a shell script and saved it in /home/user/Downloads directory and then i ran this script from the /home/user/Downloads directory. It did not execute.
however when i did set the path
export PATH=$PATH:/bin/sh within /home/user/Downloads directory, the shell script executed. Does it not mean that PATH variable is holding the locations of the shell program rather than the commands that are to be executed?
everytime i have to give the location of the shell i.e /bin/sh in the PATH variable no matter from where i am executing my script
Hi
I'm focusing on getting my head around interactive v non-interactive shells, both non-login and login. Basically what scripts are run and how local and global variables behave.
I'm pretty much there except for 'non-interactive login shells'. I understand that 'non-interactive' shells are started when a script is run. However, if I start my script with #!/bin/bash --login, then a 'non-interactive login' shell will be started.
In my mind I would have expected this to be the same as logging in from scratch, albeit without a user\password prompt. In this case I would have thought that any exported variables from the parent shell would be blown away. This doesn't appear to be the case. The 'non-interactive login' shell appears to inherit the environment of its parent 'interactive' shell.
Can anyone explain the purpose of a 'non-interactive login' shell and how they behave in this regard.
Hope this makes sense.
Cheers
Mike
Hello am a newbie to linux,
I tried to install cygwin for windows,all i need is i need to write a shell program for a batch file i already have, I am not able to do this.
My batch file content looks like
SET JAVA_HOME=..\jdk
SET CLASSPATH="%CLASSPATH%;../lib/A.jar;../lib/slf4j-api-1.6.1.jar;../lib/slf4j-simple-1.6.1.jar"
%JAVA_HOME%\bin\java.exe com.A ../conf/C.properties
PAUSE
this works perfectly, I try to write a shell program which is failing when i check it through cygwin. i am not able to set the export to java_home.
The pblm i face is say my current directory where my shell program is 'Z'
then i want to get back to 'y' where X has two sub folders y and z
X
-Y (is jdk )
-Z (where shell pgm resides)
cd ../ or any combination of cd doesnot work in my shell script.
Please help me. Any help is greatly appreciated
I am taking a Linux class and am doing horribly, I just do not understand Linux. Can anyone please tell me how to create a shell script containing the `echo`, `whoami`, `groups`, and `pwd` commands?
I can do these as individual commands but cannot figure out how to do this in a shell script and get the output to produce output similar to the following:
You a
root
You are a member of the following groups:
root bin daemon sys adm disk wheel
Your current working directory is:
/tmp
My hair is getting thinner and grayer because of this.. Please help!
hey guys, sorry for asking a dumb question, but some of the terminology online is not grasping me well, and still leaving me confused
in crontab -e
I have a shell script that contains
rsync /home/willc86 willc86@server02:/home/willc86/backup
the script works good by itself, however i have to put in a password which I understand. i know crontab works, because i used rsync script in the local machine. I am just having problems trying to sync it to another server
how do i get this rsync going in crontab to back it up to another server.
Is there an sftp package that can be used which is more flexible then the ssh internal ftp server. I have been tasked with providing an /srv/ftp/ directory which includes
mount -bind other_directory1 /srv/ftp/d1
mount -bind other_driectory2 /srv/ftp/q2
...etc
Since sftp via ssh demands that all directories be owned by root I have a problem. The 'other directories' are owned by different sets of groups. We have engineers who will have carte blanche access. I have another group 'manufacturing' who will need to be chrooted to /var/ftp/. They will need to see directories underneath /var/ftp/ and nothing else. We don't want them to be able to cd to any other part of the system. Manufacturing does not have any account on the machine. My last group sales has an account on the server. I have been able to chroot them to there home folder where they also have the same mount --binded directories. Management would like sales to be able to ftp as well as sftp with read only access to the sub directories under their home directory. It is allowable to have them sftp to /srv/ftp/ and ftp to /home/sale/. I would suppose that this may mean that I use a different tool to implement sftp rather then use ssh. Here are my setup files for ssh
Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
UseDNS no
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
UseLogin yes
Banner /etc/issue.net
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM no
Match group ftpgroup
ChrootDirectory /srv/ftp
X11Forwarding no
AllowTcpForwarding no
ForceCommand /usr/lib/openssh/sftp-server
PasswordAuthentication yes