Tag Archives: permissions

restore admins permissions in windows 8.1

1) download latest ubuntu from ubuntu.com
2) dd if=ubuntu_image.iso of=/dev/usb_device bs=8M
3) boot from usb with ubuntu
4) open terminal
5) ntfsfix /dev/drive_with_windows
6) mount -t ntfs-3g -o remove_hiberfile /dev/drive_with_windows /mnt/hdd
7) cd /mnt/hdd/Windows/System32
8) cp sethc.exe sethc.exe.orig
9) cp cmd.exe sethc.exe
10) reboot to windows
11) in the login screen click «shift» button 5 times
12) in appeared console type «mmc»
13) add user
14) add user to administration group

You're welcome!

Postgresql: export/import users with privileges

It's easy to transfer users from one instance to anothe:
#dump users and permissions
sudo -u postgres pg_dumpall -g > globals_only.dump
#restore them
cat globals_only.dump | sudo -u postgres psql
# or if you would like to choose specific user
grep USERNAME globals_only.dump

1
2
3
CREATE ROLE "USERNAME";
ALTER ROLE "USERNAME" WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN NOREPLICATION PASSWORD 'md56933b22c7ea06924799dbac5d7ed8072';
GRANT ro TO "USERNAME" GRANTED BY postgres;

These commands you could input directly to postgres command-line.

Subversion client: wrong default permissions

Default permissions on the folder with plaintext passwords from SVN:

ls -la /home/alter/.subversion/auth/svn.simple

drwxrwxr-x. 2 alter alter 4096 нояб. 7 16:44 .
drwxrwxr-x. 6 alter alter 4096 июня 14 2011 ...
-rw-r--r-- . 1 alter alter 144 июля 18 2011 28c62da73b202226d356b9ab8f841daa
-rw-rw-r-- . 1 alter alter 141 нояб. 7 16:44 292a2b271c421acc9002974b69090349
-rw-r--r-- . 1 alter alter 144 июля 19 2011 7ece931cd5b8565388b0ae20754c3215
-rw-r--r-- . 1 alter alter 132 июля 5 2011 c752ec77a7ea7af3a13b7116f986bd95

It's a holy shit !!

chmod -R 0600 /home/alter/.subversion/auth/
chmod -R +X /home/alter/.subversion/auth/

ls -la /home/alter/.subversion/auth/svn.simple

drwx--x--x. 2 alter alter 4096 нояб. 7 16:44 .
drwx--x--x. 6 alter alter 4096 июня 14 2011 ...
-rw------- . 1 alter alter 144 июля 18 2011 28c62da73b202226d356b9ab8f841daa
-rw------- . 1 alter alter 141 нояб. 7 16:44 292a2b271c421acc9002974b69090349
-rw------- . 1 alter alter 144 июля 19 2011 7ece931cd5b8565388b0ae20754c3215
-rw------- . 1 alter alter 132 июля 5 2011 c752ec77a7ea7af3a13b7116f986bd95