I don't remember my password for one of my servers. I have a working connection saved and want to get the password from it.

From Remmina faq:

Q: How are my passwords stored? Are they secure?
A: They are encrypted using 3DES with a 256bit randomly generated key. You should keep your key secure.

So where do I get the key and where would the passwords be stored?

EDIT: Ok found that they are just in your users home folder under .remmina. both the private key are in base64 and i can't seem to get the password right when decrypting......

I was able to use the Go solution by @michaelcochez to decrypt it with Python:

import base64
from Crypto.Cipher import DES3

secret = base64.decodestring('<STRING FROM remmina.prefs>')
password = base64.decodestring('<STRING FROM XXXXXXX.remmina>')

print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)
  • 2
    For reasons that make me hate myself I needed a one-liner :/ : python -c "import base64,sys;from Crypto.Cipher import DES3;pc=open('/home/admalledd/.remmina/remmina.pref').read();pci=pc.index('secret=');secret=pc[pci:pc.index('\n',pci)].split('=',1)[1];cc=open(sys.argv[1]).read();cci=cc.index('password');password=cc[cci:cc.index('\n',cci)].split('=',1)[1];secret,password=base64.decodestring(secret),base64.decodestring(password); print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)" .remmina/1474332312568.remmina. Left here for the next time I might need it. – admalledd Dec 17 '16 at 1:46
  • Nice one.. Works just fine – user169015 Feb 23 '17 at 6:57
  • 2
    The latest version of remmina has changed the location of these files. The pref file is now at: $HOME/.config/remmina/ and the connection file is listed at the bottom in remmina when you click on the connection (for example: ~/.local/share/remmina/4823893432523.remmina) – Ring Sep 8 '17 at 16:28
  • 2
    Thank you past self, slightly updated one-liner that takes two args for the files. python -c "import base64,sys;from Crypto.Cipher import DES3;pc=open(sys.argv[1]).read();pci=pc.index('secret=');secret=pc[pci:pc.index('\n',pci)].split('=',1)[1];cc=open(sys.argv[2]).read();cci=cc.index('password');password=cc[cci:cc.index('\n',cci)].split('=',1)[1];secret,password=base64.decodestring(secret),base64.decodestring(password); print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)" /tmp/remmina/remmina.pref /tmp/remmina/00000000000.remmina – admalledd Mar 10 at 1:32
  • @admalledd You really should post that as an answer! – Michael Nov 21 at 0:50

I found the key in a file called ~/.remmina/remmina.prefs and the encrypted passwords are in ~/.remmina/nnnnnnnnnnn.remmina.

I wrote a code (in Go) which can be used for decryption:

//Decrypts obfuscated passwords by Remmina - The GTK+ Remote Desktop Client
//written by Michael Cochez
package main

import (
    "crypto/cipher"
    "crypto/des"
    "encoding/base64"
    "fmt"
    "log"
)

//set the variables here

var base64secret = "yoursecret"
var base64password = "theconnectionpassword"

//The secret is used for encrypting the passwords. This can typically be found from ~/.remmina/remmina.pref on the line containing 'secret='.
//"The encrypted password used for the connection. This can typically be found from /.remmina/dddddddddddd.remmina " on the line containing 'password='.
//Copy everything after the '=' sign. Also include final '=' signs if they happen to be there.

//returns a function which can be used for decrypting passwords
func makeRemminaDecrypter(base64secret string) func(string) string {
    //decode the secret
    secret, err := base64.StdEncoding.DecodeString(base64secret)
    if err != nil {
        log.Fatal("Base 64 decoding failed:", err)
    }
    if len(secret) != 32 {
        log.Fatal("the secret is not 32 bytes long")
    }
    //the key is the 24 first bits of the secret
    key := secret[:24]
    //3DES cipher
    block, err := des.NewTripleDESCipher(key)
    if err != nil {
        log.Fatal("Failed creating the 3Des cipher block", err)
    }
    //the rest of the secret is the iv
    iv := secret[24:]
    decrypter := cipher.NewCBCDecrypter(block, iv)

    return func(encodedEncryptedPassword string) string {
        encryptedPassword, err := base64.StdEncoding.DecodeString(encodedEncryptedPassword)
        if err != nil {
            log.Fatal("Base 64 decoding failed:", err)
        }
        //in place decryption
        decrypter.CryptBlocks(encryptedPassword, encryptedPassword)
        return string(encryptedPassword)
    }
}

func main() {

    if base64secret == "yoursecret" || base64password == "theconnectionpassword" {

        log.Fatal("both base64secret and base64password variables must be set")
    }

    decrypter := makeRemminaDecrypter(base64secret)

    fmt.Printf("Passwd : %v\n", decrypter(base64password))

}

The code can be run online, but then you are trusting golang.org.

I made a script that automatically decrypt your password files. The most recent version is at https://github.com/peppelinux/remmina_password_exposer.

#!/usr/bin/python
from Crypto.Cipher import DES3
import base64
import os
import re

from os.path import expanduser
home = expanduser("~")

# costanti :)
REMMINA_FOLDER = os.getenv('REMMINA_FOLDER', home+'/'+'.remmina/')
REMMINA_PREF   = 'remmina.pref'

REGEXP_ACCOUNTS = r'[0-9]{13}\.remmina(.swp)?'
REGEXP_PREF     = r'remmina.pref'

diz = {}

fs = open(REMMINA_FOLDER+REMMINA_PREF)
fso = fs.readlines()
fs.close()

for i in fso:
    if re.findall(r'secret=', i):
        r_secret = i[len(r'secret='):][:-1]
        print 'found secret', r_secret

for f in os.listdir(REMMINA_FOLDER):
    if re.findall(REGEXP_ACCOUNTS, f): 

        o = open( REMMINA_FOLDER+f, 'r')
        fo = o.readlines()
        o.close()

        for i in fo:
            if re.findall(r'password=', i):
                r_password = i[len(r'password='):][:-1]
            if re.findall(r'^name=', i):
                r_name = i.split('=')[1][:-1]
            if re.findall(r'username=', i):
                r_username = i.split('=')[1][:-1]
        #~ print fo
        #~ print 'found', f

        password = base64.decodestring(r_password)
        secret = base64.decodestring(r_secret)

        diz[r_name] = DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)
        # print the username and password of the last decryption
        print r_name, r_username, diz[r_name]

They are stored in Gnome-Keyring.

Dash->type "keys"->Passwords&Keys.

  • 1
    tried that already..... also i'm using lxde – linuxnewb May 5 '13 at 10:21
  • 1
    This is true in some cases. Try this if the password listed in ~/.remmina/nnnnnnnnnnn.remmina is just .. – Kupiakos Apr 27 '15 at 15:05

I created a perl script to decode remmina passwords. It extract your key and decode all your saved passwords (locally).

https://github.com/lepe/scripts/blob/master/decode_remmina.pl (check for updated version)

#!/usr/bin/perl

use strict;
use warnings;
use Crypt::CBC; #Crypt::DES_EDE3
use MIME::Base64;
use File::Slurp;

my $remmina_dir = $ENV{"HOME"} . "/.remmina";
my $remmina_cfg = $remmina_dir . "/remmina.pref";

my $content = read_file($remmina_cfg);
if($content) {
    my ($secret) = $content =~ /^secret=(.*)/m;
    if($secret) {
        my $secret_bin = decode_base64($secret);
        my ($key, $iv) = ( $secret_bin =~ /.{0,24}/gs );
        my @files = <$remmina_dir/*.remmina>;

        my $des = Crypt::CBC->new( 
                -cipher=>'DES_EDE3', 
                -key=>$key, 
                -iv=>$iv,
                -header=>'none', 
                -literal_key=>1,
                -padding=>'null'
        ); 
        if(@files > 0) {
            foreach my $file (@files) {
                my $config = read_file($file);
                my ($password) = $config =~ /^password=(.*)/m;
                my ($name) = $config =~ /^name=(.*)/m;
                my ($host) = $config =~ /^server=(.*)/m;
                my ($user) = $config =~ /^username=(.*)/m;
                my $pass_bin = decode_base64($password);
                my $pass_plain = $des->decrypt( $pass_bin );
                if($pass_plain) {
                    print "$name    $host   $user   $pass_plain\n";
                }
            }
        } else {
            print "Unable to find *.remmina files \n";
        }
    } else {
        print "No secret key found...\n";
    }
} else {
    print "Unable to read content from remmina.pref\n";
}

You will need to install these packages (for example, using cpan <PACKAGE>): Crypt::CBC, Crypt::DES_EDE3, MIME::Base64, File::Slurp

Sample output:

(Name, host, user, password: tab separated)

Server1 192.168.1.25    administrator   jM822Azss2fake
Server2 192.168.1.88:2899   admin   JaxHaxFakez90

I needed to do the reverse and encrypt passwords for Remmina using a Python script. In case anyone needs it here's the code:

import base64    
from Crypto.Cipher import DES3

REMMINAPREF_SECRET_B64=b'G5XKhImmX+3MaRAWU920B31AtQLDcWEq+Geq4L+7sES='

def encryptRemminaPass(plain):
    plain = plain.encode('utf-8')
    secret = base64.b64decode(REMMINAPREF_SECRET_B64)
    key = secret[:24]
    iv = secret[24:]
    plain = plain + b"\0" * (8 - len(plain) % 8)
    cipher = DES3.new(key, DES3.MODE_CBC, iv)
    result = cipher.encrypt(plain)
    result = base64.b64encode(result)
    result = result.decode('utf-8')
    return result

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.