I used gnupg version 1.4 and this code in powershell to decrypt encrypted file worked fine:
echo mypassphrase | C:\gpg.exe --passphrase-fd 0 --output c:\list.xls --decrypt c:\gnupg\crypted\list.gpg
Now I've installed GNUPG2 and it doesn't work anymore. The only thing that changed is gpg.exe to gpg2.exe
When I run this command via command line it stucks here:
You need a passphrase to unlock the secret key for
user: "Marcel Seln (MS) <mseln#seln.sk>"
2048-bit RSA key, ID ED189121, created 2012-03-02 (main key ID 792EF596)
(only thing that helps is ctrl+c to interrupt command)
Thank you.
I found out that this problem occures too, when I use GNU Privacy Assistent. It freezes and CPU consumption was at 100%. I don't know why this happens on my brand new Windows server 2003 virtual machine, but when I restarted it, everything works fine. There is no suspicious event in Event log..
Thank you for your time!
Related
So I've got myself a new computer. Lucky me. Win 10 Pro.
But SSH is not my strong suit. I can login to my remote server via the command line using:
ssh username#myserver.com
Promted for password - straight in.
I've moved my .pub files and the config file from the .ssh directory of my old computer to to my new computer But VScode will not login. I've used ssh-keygen to create a new key and added it to .ssh/authorized_keys on the server. No login. I just keep getting:
Load key "C:/Users/myuser/.ssh/key.pub": Permission denied
What am I missing here? I've been through the process enough times to make sure there are no spelling mistakes. Everything still works on my old computer.
EDIT:
To set up the ssh key I:
ssh-keygen -t rsa -b 4096 -f %USERPROFILE%/.ssh/pub_rsa
Then:
scp -p 22 %USERPROFILE%/.ssh/pub_rsa.pub username#server.com:~/
And finally:
cat ~/pub_rsa.pub >> ~/.ssh/authorized_keys
... and of course chmod that file to 600.
ssh -i %USERPROFILE%/.ssh/pub_rsa -p 22 username#server.com
... logs in fine without being prompted for a password.
My remote-ssh config file looks like:
Host my_remote
HostName server.com
User username
Port 22
IdentityFile C:/Users/MyDir/.ssh/pub_rsa.pub
EDIT2:
If I remove the .pub from the last line of the IdentityFile, I get this error message and VScode just repeats itself failing to log on -->
Rolled back remote-ssh to version 0.49 - and that seems to have done the trick. Check this post for similar problem/solution.
First, I confirm a ssh config file would always reference the private key (in your case pub_rsa), not the public key.
Second, regarding the flock error message, check microsoft/vscode-remote-release issue 1896
find settings: Remote.SSH: Lockfiles In Tmp
check it
(seen also in issue 2059, make sure to use the latest VSCode release)
Is there a way in PS 5.1 to reuse the PuTTY agent keys?
Now, the details.
To use key agents one has an Agent that holds the keys (left box), and Client Applications that delegate administration of the keys (right box).
E.g., client application C1=putty can use its own agent A1=pageant, of course.
Client application C2=winscp knows how to use directly A1.
Certain Clients cannot use certain Agents directly, but there are Proxy agents that bridge the gap.
For instance to use A1 with C3, I need Proxy P1=ssh-pageant, see example below.
This helps centralizing in a single Agent the keys for many Clients.
Now I mean to use A1 for all my Clients (currently, only missing A1-C5 and A1-C6).
Is there a way in PS 5.1 to reuse the same PuTTY agent keys?
(I.e., a Proxy Px to use A1 with C5)
Possibly helpful:
https://superuser.com/a/1173570/245595
NOTES:
I did not try it, but it seems like winssh-pageant is a Proxy to link A2 with Client applications that understand A1 directly.
I am currently trying to use in PS the same ssh-pageant from msys2 (it is a Windows program in the end, and often times they do work), manually replacing what eval does in msys2 (so far with no luck, but I think this is fixable):
> cd <dir where ssh-pageant is>
> .\ssh-pageant -r -a "$env:USERPROFILE\tmp\.ssh-pageant-$env:USERNAME"
SSH_AUTH_SOCK='C:\Users\USER1\tmp\.ssh-pageant-USER1'; export SSH_AUTH_SOCK;
SSH_PAGEANT_PID=714; export SSH_PAGEANT_PID;
echo ssh-pageant pid 714;
> $env:SSH_AUTH_SOCK='C:\Users\USER1\tmp\.ssh-pageant-USER1'
> $env:SSH_PAGEANT_PID=714
> ssh myserver
Enter passphrase for key 'C:\Users\USER1/.ssh/id_rsa':
As an alternative workaround, is there a non-admin (I wouldn't want to interfere with it) way to load keys into a separate agent such that when I start a PS session it uses those other keys, and which allows me to keep working with my reused keys in msys2?
This would perhaps amount to using a two different agents at the same time...
weasel-pageant is such a proxy agent (based on Cygwin's ssh-pageant), for WSL (A1-C7)... still looking for a solution for PS.
ssh-agent-wsl
is a fork of weasel-pageant that includes support for using keys held by Microsoft's SSH Agent service (instead of PuTTY Pageant) (A2-C7... I guess it's remarkable that WSL needs a proxy to use Win OpenSSH agent).
Example on how to use "Proxy" agent ssh-pageant to link PuTTY pageant with Cygwin bash
The steps to achieve this are:
When I start my session in Windows, the portable PuTTY agent (pageant) is executed, loading at the same time one key.
For this, a shortcut pageant is added to C:\Users\USER1\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, pointing at %myputty%\pageant.exe "%mykeys%\key1.ppk".
This makes the key usable by PuTTY and WinSCP, e.g.
But if I now enter a PS session, or an msys2/cygwin terminal, the keys would not be used, and I am asked for the password for the keys.
So if I now
$ ssh myserver
Enter passphrase for key 'C:\Users\USER1/.ssh/id_rsa':
In msys2/cygwin I can use ssh-pageant ("An SSH authentication agent for Cygwin/MSYS that links OpenSSH to PuTTY's Pageant"), such that it reuses whatever keys a previously loaded PuTTY agent has.
For this purpose, I simply add eval $(/usr/bin/ssh-pageant -r -a "/tmp/.ssh-pageant-$USERNAME") to my ~/.bashrc of msys2.
Now whenever I start an msys2 terminal, the link PuTTY's Pageant -> ssh-pageant is established, a couple of environment variables are created, and I can ssh without entering the password
$ env | grep -i ssh
SSH_AUTH_SOCK=/tmp/.ssh-pageant-USER1
SSH_PAGEANT_PID=960
$ ssh myserver
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-40-generic x86_64)
...
Judging from this, it seems the same can be achieved for Git bash.
Related:
http://rabexc.org/posts/pitfalls-of-ssh-agents
How to check if ssh-agent is already running in bash?
https://superuser.com/questions/1327633/how-to-maintain-ssh-agent-login-session-with-windows-10s-new-openssh-and-powers
https://superuser.com/questions/1293725/gpg-agent-under-windows-as-ssh-agent-for-git-bash
I made this work, using the same Cygwin tools (i.e., both ssh-pageant and Cygwin OpenSSH client) in a PS session.
So I would do (assuming ssh-pageant is already running from Msys2):
> cd <dir where ssh-pageant is>
> .\ssh-pageant -r -a "$env:USERPROFILE\tmp\.ssh-pageant-$env:USERNAME"
SSH_AUTH_SOCK='C:\Users\USER1\tmp\.ssh-pageant-USER1'; export SSH_AUTH_SOCK;
> $env:SSH_AUTH_SOCK='C:\Users\USER1\tmp\.ssh-pageant-USER1'
> .\ssh myserver
Logged in to myserver
I have added this to my profile.ps1 (again, it will work when ssh-pageant is already running when I start the PS session)
$env:MSYS2_DIR=<mydir>
# Assuming a proxy ssh agent is already running
$env:SSH_AUTH_SOCK="$env:MSYS2_DIR\tmp\.ssh-pageant-$env:USERNAME"
# We have to make sure we use Msys2 OpenSSH ssh client, not Windows OpenSSH ssh client
function ssh_msys2 {
& $env:MSYS2_DIR\usr\bin\ssh.exe $args
}
If an ssh-pageant is not yet active, this should work (not tested yet; the PID number may be different):
> cd <dir where ssh-pageant is>
> .\ssh-pageant -r -a "$env:USERPROFILE\tmp\.ssh-pageant-$env:USERNAME"
SSH_AUTH_SOCK='C:\Users\USER1\tmp\.ssh-pageant-USER1'; export SSH_AUTH_SOCK;
SSH_PAGEANT_PID=714; export SSH_PAGEANT_PID;
echo ssh-pageant pid 714;
> $env:SSH_AUTH_SOCK='C:\Users\USER1\tmp\.ssh-pageant-USER1'
> $env:SSH_PAGEANT_PID=714
> .\ssh myserver
Logged in to myserver
Still have to test a couple of points, and automate the operation.
In particular, executing ssh-pageant, detecting the PID # if it is returned, and setting environment variable SSH_PAGEANT_PID from PS if that is the case.
This is a little bit more cumbersome than in Msys2, since ssh-pageant spits something directly executable by bash.
I'm trying to get vscode to prompt for passphrase when trying to commit as it does in windows OR at least make the time between having to enter the passphrase a lot longer.
I'm using latest on ubuntu + WSL 2, both installed today.
GPG works in the CLI if I run a test as follows:
echo "test" | gpg --clearsign
I'm being prompted for a passphrase and all is well. Then I'd be able to sign commits in vscode temporarily.
Is there an option to make the time between entering the passphrase a lot longer at least as a workaround?
EDIT:
I also have to enter this everytime I reboot my computer:
export GPG_TTY=$(tty)
Otherwise the above workaround won't work. It's been insane trying to fix this, probably spent at least 1 full day but to no use.
In your ~/.gnupg/gpg-agent.conf file, add the following:
default-cache-ttl 28800
max-cache-ttl 28800
You can also add the following to your ~/.bashrc so you do not have to manually enter it each time:
export GPG_TTY=$TTY
echo "test" | gpg --clearsign > /dev/null 2>&1
This prompts me for my password once on start and should cache for 8 hours. The > /dev/null 2>&1 bit hides the output. Currently, this is the workaround I am using--which is not ideal but bearable.
When trying to issue this command to send a file attachment from the command line I'm getting an error:
Bad IDN in "from": 'sd3.È'
sd3 is the name of my host.
The command I'm executing is:
echo "See attached file" | /usr/bin/mutt -a file.txt -s File:file.txt -- myemail#domain.com
I recently cloned an existing Centos7 server (made a copy of the virtual machine and spawned it as a second instance under a different IP) and everything has been working perfectly for awhile as far as I can tell. Not sure if that's relevant to this but it could be an indicator of what needs adjusting.
On the original server I cloned, I can run this command on without any error. I uninstalled mutt and re-installed it and I'm still getting the error.
.muttrc looks like this:
set mbox_type=Maildir
set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir"
set record="+.Sent"
set postponed="+.Drafts"
set spoolfile="~/Maildir"
I also compared the /etc/Muttrc and /etc/Muttrc.local files and they're identical between the two systems. (Muttrc.local is empty)
Running the latest version of Mutt under CentOS7: Mutt 1.5.21 (2010-09-15)
So on two almost-identical servers, one runs, one doesn't. Any ideas what might be wrong?
I encountered the same problem and it was simply solved by setting the from variable in ~/.muttrc (in fact, the file didn't exist before and this is the only thing my .muttrc contains now):
set from="something#something.com"
I was smashing my head the entire day on this issue as I'm not permitted allow to installed outside of redhat repo
I found a workaround that is using option -x
-x Emulate the mailx compose mode.
echo "This is a test message" | mutt -x -s "Test Mail" john.smith#example.com
Setting the following environment variables worked for me.
EMAIL=default#company.com
REPLYTO=$EMAIL
export EMAIL REPLYTO
After a ton of research, there appears to be some obscure bugs that are still in this stable version of mutt - which is the standard package release on CentOS7.
First I removed my old version:
yum remove mutt.x86_64
I ended up downloading the latest source of mutt, 1.9.0 from mutt.org and manually compiling and installing it.
In order to compile the source version of Mutt, I also needed to run:
yum install ncurses-devel
Now the command works without this "bad IDN" error.
It appears CentOS 7.3 had mutt-1.5.21-26.el7.x86_64 and CentOS 7.4 now has mutt-1.5.21-27.el7.x86_64.
If you don't want to compile/install from source, I found that a Fedora 22 version (mutt-1.6.2-1.fc22.x86_64.rpm) works OK. I just removed the rpm that came from CentOS 7.4 and did a local install of the Fedora 22 rpm.
I ran into this working through some automated system builds (Centos7, Mutt 1.5.21).
Using strace and some other debugging it wasn't entirely clear what the issue was, but seemed to be circling dns/domain/hostname issues. I as able to get around/recreate the error by adding/remove the "search " in the /etc/resolv.conf file (works WITH a search domain).
Without a search domain, rendered the: Bad IDN in "from": ... error
I have recently upgrade my VSCode version 1.10.2.
As I put passphrase on my private SSH key, it started to ask for it frequently even when I entered it multiple times, which is very annoying. Is there anyway I can get rid of it? Thanks.
Yes, you can avoid this prompt, without removing the passphrase.
To do so is usually fairly simple and relies on the ssh-agent program. First, before starting VSCode, at a bash shell prompt, run:
$ eval `ssh-agent`
This will start an ssh-agent process in the background that will remember the decrypted private key in its memory. The reason for eval is ssh-agent prints two environment variable settings that need to be added to the shell. (You can also just run it normally, then manually copy and paste its output back into the shell.)
Next, run:
$ ssh-add
This will prompt you for your passphrase, after which ssh-agent will provide private key services to any other process that needs it.
Finally, start VSCode from the same shell you ran the first command:
$ code
This way VSCode will inherit the environment variables it needs to get key services from ssh-agent, and therefore will not prompt for your passphrase so long as the ssh-agent process continues running.
Further References
Unfortunately, despite it being so useful, good (concise, readable) documentation on ssh-agent is hard to find. But here are some possibilities:
The man page is, as is typical for man pages, heavy on detail and light on examples.
The article http://rabexc.org/posts/using-ssh-agent is pretty good, and it covers some more advanced situations, especially agent forwarding.
The Stack Exchange question, "what's the purpose of ssh-agent?" is also good.
For Windows 10, if you have stumbled across this issue using the Remote - SSH plugin, run the following in powershell (as admin):
# Make sure you're running PowerShell as an Administrator
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent
(As suggested by the documentation that is pointed to by this comment on a git (non-)issue.)
The only solution I've found was remove the passphrase:
ssh-keygen -p
It will ask your current passphrase and leave blank the new passphrase to remove it.
Disable auto fetching with git.autofetch = false in the settings
There is a great guide on how to solve it in Windows here:
https://www.cgranade.com/blog/2016/06/06/ssh-keys-in-vscode.html
Summary:
Install Required Software (Putty)
Setup Private Keys (use ssh-keygen which will create private and public keys in .ssh folder)
Set up SSH Agent: have Pageant tool run on Windows startup
import your key to ppk format
Run PuTTYgen from the Start Menu and select File → Load Key.... From there, navigate to C:\Users\.ssh\ and select id_rsa (the private key). You may have to drop down the file types selector in the dialog box to see this, as PuTTYgen defaults to filtering out everything but files ending in *.ppk. Once selected, you’ll be prompted by PuTTY to unlock your key by typing in your passphrase. Do so, and PuTTYgen will show the corresponding public key. Select File → Save private key to export your private key in PuTTY, rather than OpenSSH, format. I suggest saving it as id_rsa.ppk in the same folder as id_rsa
run Pageant
Finally, run Pageant from the Start Menu (in the future, this will be handled automatically by the shortcut we created above). This will add a new icon to your system tray. It may be hidden by the arrow; if so, click the arrow to make all fo the system tray icons visible. Right-click on Pageant and select Add Key. Browse to where you saved id_rsa.ppk and select it. You’ll be prompted to unlock your key. Upon doing so, your unlocked key will then be made available in Pageant until you log out or quit Pageant.
Add fingerprints, in shell run one of those two (depending on your needs)
'C:\Program Files (x86)\PuTTY\plink.exe' git#github.com
'C:\Program Files (x86)\PuTTY\plink.exe' git#bitbucket.org
Configure GIT_SSH to be C:\Program Files (x86)\PuTTY\plink.exe