Why not execute scp command on centos 6? - scp

my server ip 192.168.3.247
I want use scp.
and I try
scp root#192.168.3.248:/root/disk.image/newversion/
but not execute scp
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user#]host1:]file1 ... [[user#]host2:]file2
why not execute scp command on centos 6?

use it like:
scp -r root#192.168.3.248:/root/disk.image/newversion/ .
Directories need to be copied recursively and you also need a target

Related

SCP is not working but just showing the usage

scp -r /Users/localusername/Desktop/test hostname#ipaddress/Users/hostname/Desktop
usage: scp [-346BCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]
[-J destination] [-l limit] [-o ssh_option] [-P port]
[-S program] source ... target
I try to upload a folder called “test” from a local PC to the host PC using SCP via ssh, but it always shows the usage without transferring the folder. Can anyone let me know how to fix the problem?

ssh using # without a username

Im doing some setup via the following guide,
https://www.ovirt.org/develop/dev-process/working-with-gerrit.html
Theres a step to verify the ssh config but it involves doing
ssh #gerrit.ovirt.org
This looks like a typo, don't we need a user for the # part. If no user, no # is my understanding?
[root#dub-svrfarm27 ~]# ssh #gerrit.ovirt.org
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-J [user#]host[:port]] [-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
[user#]hostname [command]
This being said...the final bit of my id_rsa.pub has this
71MgP8w== root#
So maybe there is method to this, im not sure.
It's a typo. Look again at the usage message:
[user#]hostname
The # is legal if, and only if, a user name is supplied in addition to the required host name.

issue when creating SSH using ssh-keygen -t rsa -C “your#email.com” in git it gives “Too many arguments” error

I try to create SSH for using BitBucket with TortoisGit
I have typing the command for create the SSH (gitash) and get "Too many arguments" error.
the following is the output.
Thanks :)
Yoav#Yoav-PC MINGW32 ~ $ ssh-keygen –t rsa –C "myEmail#gmail.com"
Too many arguments. usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
[-N new_passphrase] [-C comment] [-f output_keyfile]
ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
ssh-keygen -i [-m key_format] [-f input_keyfile]
ssh-keygen -e [-m key_format] [-f input_keyfile]
ssh-keygen -y [-f input_keyfile]
ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
ssh-keygen -B [-f input_keyfile]
ssh-keygen -D pkcs11
ssh-keygen -F hostname [-f known_hosts_file] [-l]
ssh-keygen -H [-f known_hosts_file]
ssh-keygen -R hostname [-f known_hosts_file]
ssh-keygen -r hostname [-f input_keyfile] [-g]
ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
[-j start_line] [-K checkpt] [-W generator]
ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
[-O option] [-V validity_interval] [-z serial_number] file ...
ssh-keygen -L [-f input_keyfile]
ssh-keygen -A
ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
file ...
ssh-keygen -Q -f krl_file file ...
Wrong dash symbol "–" in arguments; options are started with "-" (minus sign, ASCII code 0x2D). Here follows the same command with correct characters:
$ ssh-keygen -t rsa -C "myEmail#gmail.com"
Generating public/private rsa key pair.
...

Permission denied using ssh command in shell

I'm trying to execute this shell with command line
host="192.168.X.XXX"
user="USERNAME"
pass="MYPASS"
sshpass -p "$pass" scp -o StrictHostKeyChecking=no /home/MYPATH/File.import "$user#$host:/"home/MYPATH/
To copy a file from my local server in to remote server. The remote server is a copy of the remote server but when I try to execute this shell I have this error:
**PERMISSION DENIED, PLEASE TRY AGAIN**
I didn't understand why if I try to execute this command in command line is working.
USERNAME#MYSERVER:~$ sshpass -p 'MYPASS' scp -o StrictHostKeyChecking=no /home/MYPATH/File.import USERNAME#192.168.X.XXX:/home/MYPATH/
Somebody have a solution??
Please use a pipe or the -e option for the password anyway.
export SSHPASS=password
sshpass -e ssh user#remote
Your simple command with -e option:
export SSHPASS=password
sshpass -e scp -o StrictHostKeyChecking=no /home/MYPATH/File.import user#192.168.X.XXX:/home/MYPATH/
Please remove the wrong quotes from your command:
sshpass -p "$pass" scp -o StrictHostKeyChecking=no /home/MYPATH/File.import $user#$host:/home/MYPATH/
You should also be able to remove the quotes around $pass.
Please ensure that you have no special characters in your pass variable or escape them correctly (and no typos anywhere).
For simplicity use a ssh command instead of scp for testing
Use the -v or -vvv option for the scp command to check what scp is trying to do. Also check the secure log or auth.log on the remote server
You have to install "sshpass" command then use the below snippet
export SSHPASS=password
sshpass -e sftp user#hostname << !
cd sftp_path
put filename
bye
!
A gotchya that I encountered was escaping special characters in the password which wasn't necessary when entering it in interactive ssh mode.

Executing of large script in SQL Server 2008

I have a really big script (about 1GB) with UPDATE statements. Something like
UPDATE Table1 SET Col1 = 'Some text 1' WHERE ID = 1
UPDATE Table1 SET Col1 = 'Some text 2' WHERE ID = 2
-- and so on
What is the best way to execute this script? I suppose that I can't simply open it at text editor and run query...
Thanks in additional.
UPDATED
I need to run this script on remote SQL Server instance.
execute it wih the osql utility Reference
Example:
osql -E -i C:\MyFolder\MyScript.sql -o C:\MyFolder\MyOutput.rpt
you can also type for reference:
osql -?
usage: osql [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w columnwidth]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-L list servers] [-c cmdend] [-D ODBC DSN name]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-n remove numbering] [-m errorlevel]
[-r msgs to stderr] [-V severitylevel]
[-i inputfile] [-o outputfile]
[-p print statistics] [-b On error batch abort]
[-X[1] disable commands [and exit with warning]]
[-O use Old ISQL behavior disables the following]
<EOF> batch processing
Auto console width scaling
Wide messages
default errorlevel is -1 vs 1
[-? show syntax summary]
For remote server but you need the sql utility installed on the machine you run this.
osql -S <instance name> -U <username> -P <password> -i C:\MyFolder\MyScript.sql -o C:\MyFolder\MyOutput.rpt
this is will help you, it's worked very good for me
Bulk Update Data