ssh command -T option - unix

I'm wondering what the -T option in the following command does, cannot see this option in the manual somehow:
$ ssh -T git#gitlab.com
Welcome to GitLab, Simeon !
Could somebody explain?

I explained before what TTY was: a text terminal is needed when you open an interactive session to a remote server.
But: in the context of a remote Git repository hosting server (GitHub, Gitlab, BitBucket, ...), no remote server will ever allow you to open an interactive session (for security reason)
Then only reason why you would still do an ssh -T git#github.com would be to test if you are correctly authenticated, and the session would immediately end with:
Hi username! You've successfully authenticated,
but GitHub does not provide shell access.
Since no tty is needed for that test, you should use the -T option when making this test.

Related

Host key verification failed. in docker

I wanted to launch the jenkins which is installed through docker automatically in browser.. im working on windows os. in docker base os is ubuntu.. then i used solution from this link1.now im getting following error when i ssh using -v command i find that "read_passphrase: can't open /dev/tty: No such device or address"
by going through many websites i have created ssh file through windows using gitbash it contains id_rsa,id_rsa.pub,known_hosts files.
Now what should i do to launch the jenkins file in browser which is build using docker
I'm just going to address the error message you pasted for now.
ssh is trying to get keyboard input for the passphrase on your private key, but can't open the terminal correctly. Are you running the ssh command directly in the terminal, or from a script? If not, try running ssh directly. If you need to run ssh from a script:
Maybe try with keys that don't have a passphrase.
If you can use ssh-agent: Run eval $(ssh-agent), then run ssh-add and enter your passphrase. ssh will no longer prompt for a passphrase now.

Rsync command not working

I am trying to run rsync as follows and running into error sshpass: Failed to run command: No such file or directory .I verified the source /local/mnt/workspace/common/sectool and destination directories/prj/qct/wlan_rome_su_builds are available and accessible?what am I missing?how to fix this?
username#xxx-machine-02:~$ sshpass –p 'password' rsync –progress –avz –e ssh /local/mnt/workspace/common/sectool cnssbldsw#hydwclnxbld4:/prj/qct/wlan_rome_su_builds
sshpass: Failed to run command: No such file or directory
Would that be possible for you to check whether 'rsync' works without 'sshpass'?
Also, check whether the ports used by rsync is enabled. You can find the port info via cat /etc/services | grep rsync
The first thing is to make sure that ssh connection is working smoothly. You can check this via "sudo ssh -vvv cnssbldsw#hydwclnxbld4" (please post the message). In advance, If you are to receive any messages such as "ssh: connect to host hydwclnxbld4 port 22: Connection refused", the issue is with the openssh-server (not being installed or a broken package). Let's see what you get you get for the first command

ssh to execute all commands in guest machine

i was created a bash script my_vp.sh that use 2 command:
setterm -cursor off
setterm -powersave off
[...]
#execute video commands
[...]
and is in a computerA
but when i execute it by ssh by another computerB_terminal:
ssh pi#192.168.1.1
execute video commands work correctly in the computerA (the same where is the script)
but the command setterm works in the computerB (the terminal where i execute the ssh command).
somebody can help me with solucione it?
thank you very much!
I am not sure I understood the question:
to execute a local script, but on another machine:
scp /path/to/local/script.bash pi#192.168.1.1:/tmp/copy_of_script.bash
and then, if it's copied correctly, execute it:
ssh pi#192.168.1.1 "chmod +x /tmp/copy_of_script.bash"
ssh pi#192.168.1.1 "bash /tmp/copy_of_script.bash"
to have the remote video (Xwindows, etc) commands appear on the originating machine:
replace : ssh with : ssh -x (to allow X-Forwarding, which will allocate a DISPLAY automatically on the remote machine that will be tunneled back to the originating machine)
for the X-forwarding to work, there are some requirements (usually ok by default, but ymmv) : read more about those requirements in this Unix.se answer

What's the syntax and prerequisite for --password-file option in rsync?

I want to store --password-file option that comes with rsync. I don't want to use ssh public_private key encryption. I have tried this command:
rsync -avz --progress --password-file=pass.txt source destination
This says:
The --password-file option may only be used when accessing an rsync daemon.
So, I tried using:
rsync -avz --progress --password-file=pass.txt source destination rsyncd --daemon
But this return various errors like unknown options. Is my sytanx correct? How do I setup rsync daemon in my Debian machine.
That is correct,
--password-file is only applicable when connecting to a rsync daemon.
You probably haven't set it in the daemon itself though, the password you set and the one you use during that call must match.
Edit /etc/rsyncd.secrets, and set the owner/group of that file to root:root with world reading permissions.
#/etc/rsyncd.secrets
root:YourSecretestPassword
To connect to a rsync daemon, use a double colon followed by the module name, and the file or folder to synchronize (instead of a colon when using SSH),
RSYNC_PASSWORD="YourSecretestPassword"; rsync -rtv user#remotehost::module/source/ destination/
NOTE:
this implies abdicating SSH encryption, though the password itself is not sent across the network in plain text, your data is ...
this is already insecure as is, never as the the same password as any of your users account.
For a better understanding of its inner workings (how to give specific IPs/processes the ability to upload to specified areas of the filesystem without the need for a user account): http://transamrit.net/docs/rsync/
After trying a while, I got this to work. Since Im copying from my live server (and routers data) to my local server in my laptop as backup user no problem with password been unencrypted, its secured wired on my laptop at home. First you need to install sshpass if Centos with yum install sshpass then create a user backup and assign a temp password. I listed the -p option in case your ssh port is different than default.
sshpass -p 'password' rsync -vaurP -e 'ssh -p 2222' backup#???.your.ip.???:/somedir/public_data/temp/ /your/localdata/temp
Understand SSH RSA is a better permanente alternative and all that, but this is a quick alternative to backup and restore on the go. It works if you are not too concern about security but more concern about your data been backup locally as in an emergency o data recovery. Your user backup password you can change it once the backup is completed. Its a lot faster to setup when your servers change IPs, users, and its in constant modifications (as routers change config and non static IPs, also when routers are not local and you are backing up clients servers locally, where you dont have always access to do SSH. Some of my clients dont even have SSH installed and they dont want to hassle with creating public keys. On some servers only where you have access on a temporary basis. By the way, if you want to do the restore, just reverse the case. Dont need change much, from the same command shell you can do it reversing the order of target and source directories, and creating another backup user with same temp password on the target. After finish, you delete the backup user or change its passwords on target and/or source servers. You can protect even further, as I have done, replacing the password for a one line file using a bash script for multi server environment. Alternative is to use the -f option so the password does not show in the bash history -f "/path/to/passwordfile" Regards
NOTE: If you want to update only modified files then you should use this parameters -h -v -r -P -t as described here https://unix.stackexchange.com/questions/67539/how-to-rsync-only-new-files
rsync -arv -e \
"sshpass -f '/your/pass.txt' ssh -o StrictHostKeyChecking=no" \
--progress /your/source id#IP:/your/destination
Maybe you have to install "sshpass" if you not.

ssh login without any prompt

I have to login more then 150 sever and execute some unix commands.
The problem is, if I create a script which will run from one server and ssh login to 150 server and execute cmds and exit.
How can i login with any password prompt.
due to some reason i should not use ssh-keygen public and private key method , or use of some extra tool with bash line like "expect".
is there any normal way to do login through ssh in single command consisting username/password#servername like we have option in sqlplus and ftp.
There is a utility called sshpass that allows you to specify a password in the commandline.
Under Ubuntu/Debian install by using sudo apt-get install sshpass
sshpass -p 'abcedf' ssh joe#myserver.domain.com "df > ~/test; cat ~/test; rm ~/test;"
hope this helps
You can try setting up either ~/.shosts or /etc/ssh/shosts.equiv on each of your remote hosts. See man ssh under "AUTHENTICATION" for details.

Resources