The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘Cygwin’ Category

Relevant files for ssh-keygen – Wikipedia, the free encyclopedia

Posted by jpluimers on 2013/05/13

Edit:

After writing this, DSA got deprecated then later removed. See [WayBack] Secure Secure Shell.

When working with SSH private/public keys (often because of ssh-keygen), and using DSA for auhtentication, these are the relevant files:

  • $HOME/.ssh/id_dsa:
    (on the local system)
    The $HOME/.ssh/id_dsa file contains the protocol version 2 DSA authentication identity of the user.
  • $HOME/.ssh/id_dsa.pub:
    (on the local system)
    The $HOME/.ssh/id_dsa.pub file contains the DSA public key for authentication when you are using the SSH protocol version 2. A user should copy its contents in the $HOME/.ssh/authorized_keys file of the remote system where a user wants to log in using DSA authentication.
  • $HOME/.ssh/authorized_keys:
    (on the remote system)
    The $HOME/.ssh/authorized_keys file contains authorized DSA public keys (each line is the contents of a $HOME/.ssh/id_dsa.pub file) of users on systems that are auhorized to login on the remote system.

Important:

Be sure to transfer the contents of the local $HOME/.ssh/id_dsa.pub file to the remote system in a secure way.

–jeroen

via ssh-keygen – Wikipedia, the free encyclopedia.

Posted in *nix, Apple, Cygwin, Endian, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, OS X 10.8 Mountain Lion, Power User | Leave a Comment »

Link update because of rot (*nix – Mastering the VI editor)

Posted by jpluimers on 2012/09/17

Link rot stroke again: New link for Mastering the VI editor.

These are useful too:

–jeroen

via *nix – Mastering the VI editor « The Wiert Corner – irregular stream of Wiert stuff.

Posted in *nix, Cygwin, Endian, Internet, link rot, Linux, Power User, vi, WWW - the World Wide Web of information | Leave a Comment »

SSH tricks

Posted by jpluimers on 2012/08/24

SSH tricks

SSH tricks

Recommended reading:  SSH tricks

Quote:

SSH is a protocol for authenticating and encrypting remote shell sessions.

But, using SSH for just remote shell sessions ignores 90% of what it can do.

$ ssh home -L 80:reddit.com:80

This article covers less common SSH use cases, such as:

  • using passwordless, key-based login;
  • setting up local per-host configurations;
  • exporting a local service through a firewall;
  • accessing a remote service through a firewall;
  • executing commands remotely from scripts;
  • transfering files to/from remote machines;
  • mounting a filesystem through SSH; and
  • triggering admin scripts from a phone.

–jeroen

via: SSH tricks.

Posted in *nix, Apple, Cygwin, Endian, Internet, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook-Air, MacBook-Pro, Power User | Leave a Comment »

alias to have Unix list command ‘ls’ output numerical chmod permissions (via Stack Overflow)

Posted by jpluimers on 2011/04/25

Though I use Linux and Cygwin often, the discrepancy between permissions in chmod and ls still strikes me.

I mean: after all these years, does the *nix world still want newbies to learn the octal notation of file permissions and do the math themselves? Come on!

Bsaically, you can use the stat command to show the octal permissions next to the filename (so you can apply them with chmod), but sometimes it is handy to have both the chmod and ls versions next to each other.

For showing both, this awk script comes in handy.

I slightly modified it to use ls -al instead of ls -l, and condense it on one line:

ls -al|awk '{k=0;s=0;for(i=0;i<=8;i++){;k+=((substr($1,i+2,1)~/[rwxst]/)*2^(8-i));};j=4;for(i=4;i<=10;i+=3){;s+=((substr($1,i,1)~/[stST]/)*j);j/=2;};if(k){;printf("%0o%0o ",s,k);};print;}'

If you want to have it in your .bashrc or .bash_aliases, then you need to escape the double quotes and dollar signs:

alias "lsmod=ls -al|awk '{k=0;s=0;for(i=0;i<=8;i++){;k+=((substr(\$1,i+2,1)~/[rwxst]/)*2^(8-i));};j=4;for(i=4;i<=10;i+=3){;s+=((substr(\$1,i,1)~/[stST]/)*j);j/=2;};if(k){;printf(\"%0o%0o \",s,k);};print;}'"

It shows me a listing like this:
$ lsmod
0200 total 47
0755 drwxr-xr-x+ 1 jeroenp None 0 Apr 11 14:00 .
1777 drwxrwxrwt+ 1 jeroenp root 0 Apr 11 09:21 ..
0700 -rwx------ 1 jeroenp None 207 Apr 11 13:50 .bash_aliases
0600 -rw------- 1 jeroenp None 4869 Apr 11 14:00 .bash_history
0755 -rwxr-xr-x 1 jeroenp None 1103 Apr 11 09:08 .bash_profile
0755 -rwxr-xr-x 1 jeroenp None 5657 Apr 11 14:00 .bashrc
0755 -rwxr-xr-x 1 jeroenp None 5663 Apr 11 09:08 .bashrc~
0755 -rwxr-xr-x 1 jeroenp None 1461 Apr 11 09:08 .inputrc
0600 -rw------- 1 jeroenp None 564 Apr 11 14:00 .joe_state
0600 -rw------- 1 jeroenp None 99 Apr 11 13:58 .lesshst
0755 -rwxr-xr-x 1 jeroenp None 792 Apr 11 09:08 .profile
0700 drwx------+ 1 jeroenp None 0 Apr 11 13:07 .ssh
0755 drwxr-xr-x+ 1 jeroenp None 0 Apr 11 13:32 install

–jeroen

via: Can the Unix list command ‘ls’ output numerical chmod permissions? – Stack Overflow.

Posted in *nix, Cygwin, Power User | Leave a Comment »