Sponsored Content
Full Discussion: SSH script
Top Forums UNIX for Advanced & Expert Users SSH script Post 302088039 by blowtorch on Friday 8th of September 2006 06:15:39 AM
Old 09-08-2006
Quote:
Originally Posted by mercy
Yes.
ssh - it's interactive logon to system.
so, your script connected to server and waiting *your* actions.
if you want using script you should using some-thing like
Code:
#!/bin/sh
ssh user@custserver cd /custdirectory ; chmod 644 file_name_*

Er.. the ; would cause the chmod command to be executed locally and not on the custserver system. Escape the ; with \ to prevent the shell from interpreting the ;.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ssh in a script

Hi, I am trying to ssh/rlogin onto another box through a script. What is the syntax so I do not get prompted for a password. Thanks in advance (3 Replies)
Discussion started by: mrbnetbar
3 Replies

2. UNIX for Dummies Questions & Answers

ssh in script

Hi ssh has now been set up to not prompt for a password. My problem is I have the script below that I wish. Firstly ssh onto another box and then run the rest of the script problem I am not sure of the syntax. #!/bin/ksh . ${ENV}/oracle_env.ksh ****I WANT TO SSH AT THIS POINT AND... (2 Replies)
Discussion started by: mrbnetbar
2 Replies

3. Shell Programming and Scripting

SSH through a script

I want to use ssh through a script without setting key pair in those two machines. I ll take the password as input from user and then run some commands on remote machine. Can someone help me on how to do it (1 Reply)
Discussion started by: vickylife
1 Replies

4. Shell Programming and Scripting

SSH Script

So, right now I'm trying to make an SSH script for my place of employment. This script, I want to go out to the server hostnames we have specified (in another file) and change a users account password. We use Kerberized telnet, so if telnet root hostname fails, I want it to use ssh usernamehostname... (1 Reply)
Discussion started by: nkitmitto
1 Replies

5. Shell Programming and Scripting

Help on an ssh bash script...

Hey Guys, I want to have a bash script on my computer (Mac OS X 10.6.8) that can ssh into my iPod and respring. I know how do this by typing in "ssh root@10.0.1.10" and then typing in the password "alpine". From there i simply type "respring". I want to possibly put this into a shell script so it... (0 Replies)
Discussion started by: jetstream131
0 Replies

6. UNIX for Advanced & Expert Users

SSH using shell script terminates the script execution

Hello, I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes. ... (2 Replies)
Discussion started by: manaankit
2 Replies

7. Shell Programming and Scripting

ssh script

I am connecting to a remote server using this ssh command: ssh -p 2222 username@***.***.***.*** I then get a password prompt where I enter the password. I need to make an ssh connection using a script instead of doing it manually. How can I automate the connection process and make the... (2 Replies)
Discussion started by: locoroco
2 Replies

8. Shell Programming and Scripting

script for ssh

The below command executing manually from server01. It will ask the password and retrieves the result(total number of characters in a filename.txt file available in server02) (username@server01)$ ssh username@server02 wc -c /log/filename.txt username@server02's password: 25500... (1 Reply)
Discussion started by: subi.ut
1 Replies

9. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

10. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies
GIT-SHELL(1)							    Git Manual							      GIT-SHELL(1)

NAME
       git-shell - Restricted login shell for Git-only SSH access

SYNOPSIS
       chsh -s $(command -v git-shell) <user>
       git clone <user>@localhost:/path/to/repo.git
       ssh <user>@localhost

DESCRIPTION
       This is a login shell for SSH accounts to provide restricted Git access. It permits execution only of server-side Git commands implementing
       the pull/push functionality, plus custom commands present in a subdirectory named git-shell-commands in the user's home directory.

COMMANDS
       git shell accepts the following commands after the -c option:

       git receive-pack <argument>, git upload-pack <argument>, git upload-archive <argument>
	   Call the corresponding server-side command to support the client's git push, git fetch, or git archive --remote request.

       cvs server
	   Imitate a CVS server. See git-cvsserver(1).

       If a ~/git-shell-commands directory is present, git shell will also handle other, custom commands by running "git-shell-commands/<command>
       <arguments>" from the user's home directory.

INTERACTIVE USE
       By default, the commands above can be executed only with the -c option; the shell is not interactive.

       If a ~/git-shell-commands directory is present, git shell can also be run interactively (with no arguments). If a help command is present
       in the git-shell-commands directory, it is run to provide the user with an overview of allowed actions. Then a "git> " prompt is presented
       at which one can enter any of the commands from the git-shell-commands directory, or exit to close the connection.

       Generally this mode is used as an administrative interface to allow users to list repositories they have access to, create, delete, or
       rename repositories, or change repository descriptions and permissions.

       If a no-interactive-login command exists, then it is run and the interactive shell is aborted.

EXAMPLE
       To disable interactive logins, displaying a greeting instead:

	   $ chsh -s /usr/bin/git-shell
	   $ mkdir $HOME/git-shell-commands
	   $ cat >$HOME/git-shell-commands/no-interactive-login <<EOF
	   #!/bin/sh
	   printf '%s
' "Hi $USER! You've successfully authenticated, but I do not"
	   printf '%s
' "provide interactive shell access."
	   exit 128
	   EOF
	   $ chmod +x $HOME/git-shell-commands/no-interactive-login

       To enable git-cvsserver access (which should generally have the no-interactive-login example above as a prerequisite, as creating the
       git-shell-commands directory allows interactive logins):

	   $ cat >$HOME/git-shell-commands/cvs <<EOF
	   if ! test $# = 1 && test "$1" = "server"
	   then
		   echo >&2 "git-cvsserver only handles "server""
		   exit 1
	   fi
	   exec git cvsserver server
	   EOF
	   $ chmod +x $HOME/git-shell-commands/cvs

SEE ALSO
       ssh(1), git-daemon(1), contrib/git-shell-commands/README

GIT
       Part of the git(1) suite

Git 2.17.1							    10/05/2018							      GIT-SHELL(1)
All times are GMT -4. The time now is 09:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy