buttonsrtoys
buttonsrtoys

Reputation: 2771

Simple deb package for Debian Lenny?

On our NAS running Debian Lenny I stupidly set PermitRootLogin to without-password in sshd_config without properly setting up the keys first and am now locked out. It's a WD Sharespace and reading up on it it looks like my best way to restore root SSH access is to create a deb package that overwrites the original sshd_config file. The sites I've found describing deb package creation are pretty onerous. All I need the package to do is overwrite a single file. Is there a simple way to do this?

Upvotes: 1

Views: 195

Answers (2)

user3710044
user3710044

Reputation: 2334

As an alternative that exists in Lenny and many other distributions is the "alien" command. It converts packages from one distribution to another. This wouldn't be much use except for the fact that it's VERY forgiving of Slackware TGZ packages. It will accept ANY TGZ file (pkgname_version.tar.gz) with paths beginning at the root directory and convert that TGZ to a plain deb file for installation.

It has several options to tailor the package (set versions tags etc etc) but the end result is a package that can installed/removed or replace any package on the system without hassle.

Upvotes: 0

Ramón
Ramón

Reputation: 561

There are some tools that make it easier to do some simple packaging, but packaging is a fundamentally complex task since packages can do so many things (write out binaries, configuration files, run postinstall scripts, etc.)

That said, if all you need to do is package a file to appear at a specific location, one such tool is fpm (needs Ruby). Not to disrespect fpm, it can do much more than just package a dir full of stuff!

Create the directory structure you want to have packaged somewhere, here in /tmp. Act as if /tmp/mypackage is the root of your target filesystem, so anything you place in mypackage/etc will show up in /etc after installing the package:

mkdir -p /tmp/mypackage/etc
echo "My file contents" > /tmp/mypackage/etc/my_config_file

Stick your sshd_config file in that etc directory. Then we package that up:

fpm -t "deb" -n "mypackage" -s dir /tmp/mypackage

You should get something like:

Created package {:path=>"mypackage_1.0_amd64.deb"}

Make sure to set the right architecture (I don't know what the WD Sharespace uses) with the -a option. Once you install that package on your NAS, the config file should show up there.

Upvotes: 1

Related Questions