Monday, 15 April 2019

Change default editor Linux

You can change default terminal editor to vim:

$ sudo update-alternatives --config editor

add user to admin group via PolKit

Latest Ubuntu uses PolicyKit so from that time you can use polkit to add user to admin group:

$ sudo usermod -aG sudo MyDearUser

Friday, 12 April 2019

Custom Git Username For ssh clone

Probably you meet the followings when you using vagrant or virtualbox:

vagrant@vagrant:~$ git clone ssh://gerrit.mycompany.com:29418/sample
Cloning into 'sample'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


To solve (if you sure chmod is fine on your .ssh folder and files) you have to send your username also:
GIT_SSH_COMMAND="ssh -o User=MyGodUserName"

vagrant@vagrant:~$ GIT_SSH_COMMAND="ssh -o User=MyGodUserName" git clone ssh://gerrit.mycompany.com:29418/sample
Cloning into 'sample'...
remote: Counting objects: 21, done
remote: Finding sources: 100% (21/21)
remote: Total 18416 (delta 0), reused 18397 (delta 0)
Receiving objects: 100% (18416/18416), 6.63 MiB | 17.91 MiB/s, done.
Resolving deltas: 100% (11663/11663), done.

And now it works like charm.

Monday, 4 February 2019

Automate login via ssh

Generate a passphrase less SSH key and push it to your PC.

$ ssh-keygen -t rsa -b 2048
$ ssh-copy-id id@server
$ ssh id@server

Use sudo without password per USER

$ sudo visudo

Enter the following the end of the file:

<username> ALL=(ALL) NOPASSWD: ALL

Comment:
<username>: a user that exists under /home/

e.g.:
SamplePista ALL=(ALL) NOPASSWD: ALL

With this setting OS won't ask password for 'SamplePista' when execute command via sudo.

Another useful debug flag(s) for linker Visual Studio

Use the /VERBOSE:LIB option to find out which libraries the linker is searching.

/VERBOSE:LIB