Windows public ssh key on remote linux [closed] - windows

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have public ssh key created on Windows 7 and I want to install it on remote Debian. How to do it?

This question here is off-topic and will probably be moved to http://serverfault.com.
However, copy your public key to the remote debian system with scp (I don't have a Windows machine, so I will give you Linux instruction, try to understand them and modify them according to your operative system):
scp /path/to/public/key.pub user#debian-server:~/.ssh/key.pub
It will ask your password to log in, then it will copy the key and log out.
Log in again in your machine with ssh and do the following:
ssh user#debian-server
chmod 700 .ssh
cd .ssh
cat key.pub >> authorized_keys
chmod 600 authorized_keys
exit
Now, you should be able to log in remotely without issuing your password, providing that RSA authentication method is enabled in sshd_config on the debian server.
Note: the chmod part is not worldwide required, but sometimes wrong permission on files and folder will prevent you to correctly login.

You have to store your public key into .ssh/authorized_keys on your debian machine.
You will find the .ssh folder in your home directory if openssh-server is installed.

Related

Multiple SSH keys from Windows client to multiple servers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
A lot of people here seem to have the same issue, but with Github.
I don't think that is my issue.
I am fairly new to this so I apologize if this is a duplicate question or if this is a stupid question.
I manage multiple ubuntu servers and I access them from my Windows computer.
I am currently attempting to have ssh keys for all of the servers I have, but it seems like I cannot change the name of the RSA keys or directories. If I do that, the terminal asks me for a password.
Here's what I did:
In my server:
mkdir ~/.ssh && chmod 700 ~/.ssh
On my windows machine:
ssh-keygen -b 4096
Prompts me:
Enter file in which to save the key (C:\Users\Me/.ssh/id_rsa):
Which I enter:
C:\Users\Me\.ssh\server1\server1_rsa
scp C:\Users\me\.ssh\server1_rsa.pub server#serverip:~/.ssh/authorized_keys
(I want to have different directories or something to seperate the SSH keys)
Maybe something like this?
/.ssh
/server1
server1 pub
-erver1 priv
/server2
server2 pub
server1 priv
or maybe even
/.ssh
server1 pub
server1 priv
server2 pub
server2 priv
But this doesnt work.
Any suggestions?
Solution from .ssh/config file for windows (git)
Create a file called "config" in C:\Users\Me.ssh
(no file extension)
Then add the following information per key/server
Host server1ip
User user
Port port
IdentitiesOnly=yes
PreferredAuthentications publickey
PasswordAuthentication no
# CMD
IdentityFile C:\Users\[User]\.ssh\[name_of_PRIVATE_key_file]
# BASH
IdentityFile /c/Users/[User]/.ssh/[name_of_PRIVATE_key_file]
I am sorry if this answer is not making you happy, but I think it will solve your problem :). There is a post on stackoverflow, where you have to add the keys to your ssh-agent.
Kind regards
.ssh/config file for windows (git)

How to execute a scp command inside an ssh session? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
How to copy a file located locally in my folder, while being connected in SSH?
This command works perfectly, but only when I run it locally:
scp /home/josh/Desktop/DATA/import/file001.csv root#10.0.3.14:/var/www/html/project
I would like to have the same result in launching it by being connected in ssh, is it possible?
You can setup ControlMaster in your .ssh/config
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
Then use ssh command mode which will reuse existing connection:
Solution with push ssh session into background:
local$ ssh remote
remote$ ~^Z # Shift+`, Ctrl+z - Push ssh into background
local$ scp file remote:/remotepath
local$ fg
remote$
You can also to open tunnel via:
remote$ ~C # Shift+`, Shift+c - Enter command mode
ssh> -R15000:localhost:22 # tunnel to local:22 from remote:15000
Forwarding port.
remote$ scp -P15000 localhost:/filepath ~/
remote$ ~C
ssh> -KR15000
Canceled forwarding.
remote$
STEP 1 : Get the ip address
hostname -I
STEP 2 : Call SCP into SSH
scp josh#my_ip_address:~/Desktop/DATA/import/file001.csv /var/www/html/project
ie: "josh" is my name for the connection into my PC

How to open putty using batch and login then execute list of commands on bash [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have a Sun OS server with oracle configured on it ; with database 11g i want to take backup , now am connecting to terminal using ssh on putty console but , what i need is finding a way to make it possible to connect using batch to ssh to the server then login then login to oracle then take the backup, is that possible and how.
If you really want to use putty to do this you can use the below in your command prompt in Windows(this will open the putty and its terminal and execute the passed argument in you text file):
putty.exe plink -ssh -load profileName -l username -pw password -m commandPath -t
Or
putty.exe -ssh username#ip -pw password -m commandPath
e.g:
putty.exe -ssh rootz#10.10.10.10 -pw rootzpass -m c:\commands\mycommands.txt
Where profileName is the profile saved in putty and the commandPath is your local directory text file containing the commands you want to execute and the username is the server user and ip is the IP address for the server , the password is your server password then you can put whatever commands you want in your textFile.
Reference
the.earth putty documentation

How can I transfer a file after having already logged in to a server via ssh? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
This is a rather odd and embarrassing situation for all involved.
Suppose someone (cough cough not me cough cough) accidentally chmod 000d my home directory on a remote server.
I had been using ssh keys to login, since I figured I would forget the actual password on the remote host (which I have). However, now that my home directory has 000 perms, the ssh key in ~/.ssh/authorized_keys is unreadable, and ssh forces me to put in a password that I have long since forgotten.
Also, I don't have sudo superpowers on the remote server.
HOWEVER, I happen to have an ssh session open to the remote server that started before someone (cough) chmod 000d my home directory.
All of this happened while I was trying to upload some files from my local host to a publicly accessible directory in my home directory.
CAN I STILL UPLOAD FILES FROM MY LOCAL MACHINE TO THE REMOTE MACHINE WITHOUT NEEDING A NEW SSH SESSION?!
I figure I could at least put them in /tmp or something for now.
Yes you can!
Press enter,~,Shift+C to open a ssh command line.
Enter -L 12345:localhost:12345 to forward a new port over your existing SSH connection
Run nc -l -p 12345 | tar xzv on your remote ssh session
Run tar czv FileOrDir1 FileOrDir2 Etc | nc localhost 12345 on your local system.
The files will now transfer over your existing ssh connection, and will appear in the current dir of your remote session.
Why you would want to do this instead of just chmod 711 ~ is beyond me though.

Copy files from local linux computer to amazon aws linux instance [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How do you copy files from local linux computer to amazon aws linux instance?
We can do that through scp command shown below:
scp -i testkey1.pem sourcefile ec2-user#ec2-51-122-239-158.us-west-2.compute.amazonaws.com:outputfile
or if you want to copy a complete directory
scp -i testkey1.pem -r sourcefolder/ ec2-user#51.122.444.128:~/
-i is the option for pem file
ec2-51-122-239-158.us-west-2.compute.amazonaws.com is the public dns
address, You can get this value from aws console of your instance.
If you are looking for a GUI approach you can use SFTP. Many programs like Transmit for Mac or Filezilla can connect to your instance through SSH by connecting to the public DNS name (found in AWS console).
If you want you can definitely use SCP and it is very reliable as you suggested.

Resources