How to access `/.ssh` directory in windows? - linux

I have followed the instructions here using OpenSSH in Windows 10 and created an ssh key stored in this directory: C:\Users\MyUser/.ssh/id_rsa ,as the message I get says.
How do I actually find this directory from the windows cmd (or file explorer) so I can get my ssh key pair?
When I try to cd there I get an error that the directory does not exist.

Related

Can not copy files From Azure VM to local Windows

I want to copy file from Azure Linux VM to local Windows PC. Actually I remember, I could do this perfectly with the same command but now when I run the cmd it shows message as 100% done but when I go to tmp directory, I dont see the file there.
Here is the cmd I give on Linux VM:
scp -r mlopenedx#138.91.116.170:/edx/var/log/tracking/tracking.log /tmp/
And this is output I get:
tracking.log 100% 70KB 70.0KB/s 00:00
But when I see tmp folder I dont see the file.Can any on suggest me the answer.
I have tried things like: giving Home folder ~/ instead of /tmp/.
Also tried below cmd:
sudo scp -i ~/.ssh/id_rsa mlopenedx#MillionEdx:/edx/var/log/tracking/tracking.log /tmp/
The easiest way to do this is to run pscp from windows like this:
pscp mlopenedx#LINUXVMIP:/edx/var/log/tracking/tracking.log c:/someExistingFolder/tracking.log
to have pscp command you need to install PuTTY.
your command looks wrong as one of the paths needs to be Windows valid path C:/Folder/Folder/File.ext. If you are executing that command from Linux VM and 138.91.116.170 is your Linux vm IP address than you are copping files locally - you can try finding your log file on that linux in \tmp\ folder. In order for that to work from remote Linux to local Windows you would need public IP for your windows or some sort of tunnel that would allow this connection.
Also you are adding -r recursive copy and you are pointing to file.

pscp between linux and windows

I am trying to scp file(s) from window to linux.
user is windows system, we are executing pscp from linux command
Command used :
pscp user#ip:source dest
It shows :
unable to identify source: permission denied
If I use it in this way,
pscp source user#ip:dest
It works fine and copy the files to windows.
Am I using correct format?
We need to copy from remote windows, but the commands needs to be invoked from local linux system.
Here is an example of how I copy a file from my windows machine to my linux machine
C:\Users...\Downloads>pscp -i "DEV_IRM.ppk"
product-sp-4.2.0-rc2.tar.gz
prvclouduser#10.149.137.26:/home/prvclouduser/sp420
Make sure that you are in the directory where the file you want to copy is located. In my case 'Downloads' directory.
Private key for access: DEV_IRM.ppk
My linux server: prvclouduser#10.149.137.26
The landing directory in linux: /home/prvclouduser/sp420 (make sure this exists; do pwd to confirm full path)

git clone - permissions OK when run from Windows command line but not from Cygwin

If I run a 'git clone' from the Windows 10 command line to a Linux remote repo in our office, there seem to be no permission issues; I'm presented with an ssh login prompt to the remote server, my password is accepted, and the clone runs to completion without a problem.
If I run the same 'git clone' from Cygwin, I don't even get the login prompt and the git command fails with:
Permission denied (publickey,password)
The thing is, I think I know why the problem is happening, but not what to do about it.
Image my name is John Smith. My credentials as stored by the remote Linux server are 'john.smith'. My Windows user folder is 'C:\Users\john.smith'. However, when I start a Cygwin session, the prompt is actually 'John.Smith#myhostname'. So because Windows is case-insensitive, the git clone works because the Windows copy of 'known-hosts' can be located (no case issues). However, the copy of 'known-hosts' in Cygwin isn't being located because of the mismatch between the Unix username (john.smith) and the Cygwin username (John.Smith). That's my theory anyway !
What do I need to do in Cygwin to lower-case my username so that everything aligns ?
Thanks
Can you try to issue the clone command with the format: john.smith#linuxhost:path/to/repo?
Check where your git configuration is
git config --list --show-origin
cygwin probably uses /home/john.smith as home/profile folder(directory).
But here is main issue ssh configuration.
You could copy your ssh private and host keys from windows location to cygwin home .ssh directory.
Check in your Cygwin install folder under <install-path>/Cygwin/home/<username>
You should find:
.gitconfig - edit this to change your username and email address etc...
.ssh - this contains your known-hosts and id_rsa ssh keys. You probably need to copy your windows ones into here.
You may also find other issues in Cygwin like auto complete not working? and a few other gotchas...?

Blank SSHFS mount folder

I am attempting to mount a remote directory located on my web server to a directory in my xUbuntu installedation hosted in a VirtualBox.
I'm using the following command syntax:
sshfs root#*.*.*.*:/var/www Desktop/RemoteMount
Using the file manager, I navigate to the Desktop/RemoteMount directory but find it entirely blank. The SSHFS command above executed with no indication of an error.
Completely by chance, I use the terminal to long list the contents of the Desktop/RemoteMount directory and it shows all the data I was expecting to see in the file manager.
Can anyone tell me why the file manager does not show my remotely mounted data and how I might fix it?
Thanks.
you are missing local mountpoint.
sshfs -o idmap=user mika#192.168.1.2:/home/mika/remotepoint /home/mika/localmountpoint.
And You need to have localmount folder exist.
thanks Mika

Using putty to scp from windows to Linux

I'm trying to test some C code that I'm writing. The only issue is that the code needs to be executed on a remote machine.
My laptop is pretty old, and there is no driver for my wireless card available for Ubuntu, so booting into Linux to circumvent this problem isn't an option.
Here's my question:
I'm using putty to SSH into the remote machine, and I'm writing my code on Notepad++.
The location of my file is:
C:\Users\Admin\Desktop\WMU\5260\A2.c
My problem is that when I use the command scp C:\Users\Admin\Desktop\WMU\5260\A2.c ~
I get the error could not resolve hostname C:. Name or service not known".
I've also tried scp Users\Admin\Desktop\WMU\5260\A2.c ~ which gives me the error Cannot stat 'Users\Admin\Desktop\WMU\5260\A2.c': no such file or directory
What am I doing incorrectly?
You need to tell scp where to send the file. In your command that is not working:
scp C:\Users\Admin\Desktop\WMU\5260\A2.c ~
You have not mentioned a remote server. scp uses : to delimit the host and path, so it thinks you have asked it to download a file at the path \Users\Admin\Desktop\WMU\5260\A2.c from the host C to your local home directory.
The correct upload command, based on your comments, should be something like:
C:\> pscp C:\Users\Admin\Desktop\WMU\5260\A2.c ckg8221#thor.cs.wmich.edu:
If you are running the command from your home directory, you can use a relative path:
C:\Users\Admin> pscp Desktop\WMU\5260\A2.c ckg8221#thor.cs.wmich.edu:
You can also mention the directory where you want to this folder to be downloaded to at the remote server. i.e by just adding a path to the folder as below:
C:/> pscp C:\Users\Admin\Desktop\WMU\5260\A2.c ckg8221#thor.cs.wmich.edu:/home/path_to_the_folder/
You can use PSCP to copy files from Windows to Linux.
Download PSCP from putty.org
Open cmd in the directory with pscp.exe file
Type command pscp source_file user#host:destination_file
Ex.
pscp sample.txt myuser#myhost.com:/mydata/sample.txt
Reference
Use scp priv_key.pem source user#host:target if you need to connect using a private key.
or if using pscp then use pscp -i priv_key.ppk source user#host:target

Resources