Search this site


Metadata

Articles

Projects

Presentations

Get a screen terminfo entry on Solaris.

Solaris doesn't have a 'screen' terminfo entry by default, so you might notice that if you set TERM to 'screen' things don't work right.

Screen itself comes with a termcap entry. If you install using the sunfreeware package, the termcap file will be: /usr/local/doc/screen/terminfo/screencap

We need to convert this to a terminfo file and compile it. All tools used below come standard with Solaris.

# captoinfo screencap > screen.ti
"screencap", line 2, col 24, terminal 'screen': unknown capability 'G0'
"screencap", line 18, col 58, terminal 'screen': unknown capability 'AX'
# tic screen.ti
# ls -d /usr/share/lib/terminfo/s/screen* 
/usr/share/lib/terminfo/s/screen     /usr/share/lib/terminfo/s/screen-w
Note: Make sure you're running /usr/bin/tic, not /usr/local/bin/tic (comes with some sunfreeware package). The /usr/local/bin/tic will write it's terminfo file to /usr/local/share/terminfo which isn't used by any shell I've tried, not by default anyway. Something to keep in mind.

Now you've got a screen terminfo entry. Setting your TERM to 'screen' should work now, which is the default inside new screen sessions.

Getting public-key auth working in Solaris 10

Once upon a time, there was a Solaris 10 box where I wasn't able to use ssh keys to login.

Thankfully, that time has now passed. The problem was because PAM was denying access with public keys.

Running sshd in debug mode (-ddd) I would see this:

Found matching DSA key: 80:aa:32:03:ef:51:9c:7b:0f:1d:ac:37:17:d5:fd:2b
debug1: restore_uid: 0/0
debug1: ssh_dss_verify: signature correct
debug2: Starting PAM service sshd-pubkey for method publickey
debug3: Trying to reverse map address 69.181.132.53.
debug2: userauth_pubkey: authenticated 0 pkalg ssh-dss
Failed publickey for psionic from 69.181.132.53 port 55957 ssh2
Clearly indicated here, is the fact that it accepted my ssh-dss key, but I failed for some other reason. Listed here, is: Starting PAM service sshd-pubkey for method publickey. Solaris 10's manpage for sshd shows that it uses different PAM service names for each type of authentication.

The solution involved adding a simple service entry in /etc/pam.conf:

sshd-pubkey    auth required           pam_unix_cred.so.1
It works now. This takes effect immediately as the pam config is invoked any time sshd uses pam, so you don't have to restart sshd.

Parsing nfsstat(1) for only version X information

nfsstat | sed -ne '/Version 3/,/^$/p'
sed++

When I was bored (at 4 am, no-less), I kept trying to parse this information out using some crazy tricks with 'x' (swap pattern/hold) and other stuff, but I forgot the fact that regexps are valid addresses. So, we can print anything between 'Version 3' and blank lines, anywhere in our output.

The next thing I want to try with this is to automagically parse nfsstat output into a format that is more machine readable, this will probably be using awk or perl, seeing as how doing it with sed may hurt my brain a bit. Furthermore, trying to read the sed that did said operations would be somewhat intense ;)

The output looks something like this, on Solaris 9:

Version 3: (535958 calls)
null        getattr     setattr     lookup      access      readlink    
0 0%        242223 45%  20606 3%    52504 9%    20025 3%    41 0%       
read        write       create      mkdir       symlink     mknod       
14138 2%    146618 27%  5525 1%     145 0%      337 0%      0 0%        
remove      rmdir       rename      link        readdir     readdirplus 
6279 1%     7 0%        1539 0%     1518 0%     1606 0%     6587 1%     
Parsing this would mean generating a tree-like dictionary. In perl, it may look like:
%foo = (
	'Version 3' => {
		null => 0,
		getattr => 242223,
		setattr => 20606,
		lookup => 52504,
		# .... etc ...
		}
	)
Should be simple enough, we'll see what happens next time I get bored.

getting pageup/pagedown to work properly under solaris (Xsun)

The default handling of pageup and pagedown by xterm under Xsun is annoying. When you hit page up in xterm, it scrolls up. This behavior is undesirable and different from what I'm used to using. So, Xresources to the rescue.

Xterm supports a number of options including keybindings, here's my fix. This will send a "page up" or "page down" character sequence to your terminal if you hit page up or page down, respectively. Shift+pageup still works as expected (actually scrolls)

! Override default action when hitting pageup and pagedown - actually
! send the ANSI code for page up
*VT100.translations: #override \n\
	~Shift <Key>Prior: string(0x1b) string("[5~") \n\
	~Shift <Key>Next: string(0x1b) string("[6~") \n

Put that in your .Xresources and load it with:

xrdb -merge .Xresources

This file should get loaded automatically when you login through dtlogin, but I haven't tested this yet.