LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-27-2013, 05:40 PM   #1
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,356

Rep: Reputation: 76
Upgrading Slackware and maintaining users


So I have home on a separate partition. In every previous upgrade since 9.1 I have gone through the tedious process of adduser for all 6 potential logins to my PC making sure to maintain the same userid.

Is there an easier way to do this say simply copying some files? I am guessing /etc/passwd and /etc/shadow. Are there any other things I would need to do
 
Old 11-27-2013, 05:48 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,311
Blog Entries: 24

Rep: Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263
Quote:
Originally Posted by arubin View Post
So I have home on a separate partition. In every previous upgrade since 9.1 I have gone through the tedious process of adduser for all 6 potential logins to my PC making sure to maintain the same userid.

Is there an easier way to do this say simply copying some files? I am guessing /etc/passwd and /etc/shadow. Are there any other things I would need to do
I keep my user definitions in a script I named mkusers.sh which I upload to all new installs. I then comment/uncomment or add new lines as required.

In addition to the mkusers.sh I also keep a master archive of quite a few things to speed setup of a new install, including...

/etc/skel {.bashrc, .bash_profile, .vimrc, .tmuxrc... etc.}
/usr/share/vim/vim7x/colors/mycolors.vim
/etc/inputrc
/etc/bashrc
/root/utils/mkusers.sh
/root/utils/... various local utilities
/root/INSTALL_README - Itemized list of things to do, like /usr/vi -> vim, plus notes on setting things up

Then it is a snap to set up a new box from scratch that will be right at home on my local network. Simply install the new system, untar the archive into /root/, then move everything into place as required (I never untar to the actual locations).

Last edited by astrogeek; 11-27-2013 at 05:51 PM.
 
Old 11-27-2013, 06:13 PM   #3
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,290

Rep: Reputation: Disabled
I'd put as many "useradd" commands as needed in a script run after each installation.
 
Old 11-27-2013, 06:43 PM   #4
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, Alma, OpenBSD, FreeBSD
Posts: 562

Rep: Reputation: Disabled
You can always backup your /etc/passwd, /etc/group and the other related files.

As far as I am aware however, the etc package is what contains these files and they're all appended with ".new" so you may be able to simply not replace your old files with the new ones and they should be preserved unless I am missing something.
 
Old 11-27-2013, 07:28 PM   #5
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 278

Rep: Reputation: 41
Quote:
Originally Posted by arubin View Post
So I have home on a separate partition. In every previous upgrade since 9.1 I have gone through the tedious process of adduser for all 6 potential logins to my PC making sure to maintain the same userid.

Is there an easier way to do this say simply copying some files? I am guessing /etc/passwd and /etc/shadow. Are there any other things I would need to do
I can't help asking why? Upgrade does not remove any user, as long as you don't do something dumb like overriding the user files (passwd, group and shadow) with their .new variant. Sounds like you have been making work for yourself all these years .
 
Old 11-27-2013, 07:38 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,311
Blog Entries: 24

Rep: Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263Reputation: 4263
Quote:
Originally Posted by tux_dude View Post
I can't help asking why? Upgrade does not remove any user, as long as you don't do something dumb like overriding the user files (passwd, group and shadow) with their .new variant. Sounds like you have been making work for yourself all these years .
I understood the "upgrade" to be a new install but retaining the same /home on a separate partiton - perhaps because that is how I have always done it (only recently began using slackpkg to follow current). Otherwise, as you say, there would be no need to ask the question I think.
 
Old 11-28-2013, 03:29 AM   #7
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,356

Original Poster
Rep: Reputation: 76
Yes. I expressed myself badly. My 'upgrade' is always a fresh install. And the question remains. What files do I need to make sure get copied over to maintain my users? Is it just 3 files: passwd, group and shadow?

I have also thought of writing an useradd script but when it comes down to it have always just gone ahead and done it manually rather than sit down and figure out the man pages of the useradd command.

Last edited by arubin; 11-28-2013 at 03:32 AM.
 
Old 11-28-2013, 03:39 AM   #8
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,290

Rep: Reputation: Disabled
Quote:
Originally Posted by arubin View Post
Yes. I expressed myself badly. My 'upgrade' is always a fresh install. And the question remains. What files do I need to make sure get copied over to maintain my users? Is it just 3 files: passwd, group and shadow?

I have also thought of writing an useradd script but when it comes down to it have always just gone ahead and done it manually rather than sit down and figure out the man pages of the useradd command.
Too bad you're too busy to just type once "man useradd" as it gives the answer to your question: it states what files are involved and for what purpose. Just scroll down as it's near end of man page.

Last edited by Didier Spaier; 11-28-2013 at 03:42 AM.
 
Old 11-28-2013, 03:42 AM   #9
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156
If you have many users to manage, consider using roaming profiles on a server. So you can upgrade the desktop clients and retrieve all your users and data.
 
Old 11-28-2013, 03:50 AM   #10
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 278

Rep: Reputation: 41
Quote:
Originally Posted by arubin View Post
Yes. I expressed myself badly. My 'upgrade' is always a fresh install. And the question remains. What files do I need to make sure get copied over to maintain my users? Is it just 3 files: passwd, group and shadow?

I have also thought of writing an useradd script but when it comes down to it have always just gone ahead and done it manually rather than sit down and figure out the man pages of the useradd command.
Why do a fresh install if you want to retain settings? Isn't the idea of a fresh install to start clean? Why not do an upgrade and avoid the headache or recreating your users.

Seeing that you posted from Windows, I can't help thinking that a fresh install is a Windows habit being used with Slackware.
 
Old 11-28-2013, 04:06 AM   #11
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,356

Original Poster
Rep: Reputation: 76
Tux dude: I find a fresh install clean and easy. Like a spring clean for the system.

You assume too much. I post from Windows because that is what we have to use at my place of work. I haven't installed a Windows system since I put Windows XP on vmplayer about 8 years ago.

So it seems if I am to understand Didier Spaier's reply ( thanks but the sarcasm was unworthy of you ) that the answer is:

/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow

or a script something like
useradd -d /data/home/alan -s /bin/bash –c “Full Name” -g users -G audio,cdrom,floppy,plugdev,video alan
 
Old 11-28-2013, 04:17 AM   #12
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156Reputation: 2156
Quote:
Originally Posted by tux_dude View Post
Seeing that you posted from Windows, I can't help thinking that a fresh install is a Windows habit being used with Slackware.
Even on distributions with a more or less painless upgrade (Debian, Ubuntu), I always prefer a clean installation over a "live" upgrade. My experience is that 99% of the upgrade process goes well, and then you spend a couple of afternoons finding out why that 1% behaves differently than a clean installation.

Of course, when it can't really be avoided, I'll go for the "live" upgrade.

http://www.microlinux.fr/slackware/L...rade-HOWTO.txt

Last edited by kikinovak; 11-28-2013 at 04:18 AM.
 
Old 11-28-2013, 04:21 AM   #13
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 278

Rep: Reputation: 41
Quote:
Originally Posted by arubin View Post
Tux dude: I find a fresh install clean and easy. Like a spring clean for the system.
This is why I avoid fresh installs. It's way more work than its worth. Light dusting every few weeks prevents being tied down for days doing "Spring Cleaning". It's even worst if the weather is great outside.
 
Old 11-28-2013, 09:40 AM   #14
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
What you're talking about is pretty much what I've done for who knows how many Slackware releases.

I have multiple partitions on multiple servers. They are all identical sizes although some are separate drives and some are on a single drive (like a lap top). The partitioning I do is:
Code:
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        15G  7.5G  6.4G  55% /
/dev/sda10      173G  128M  164G   1% /var/lib/pgsql
/dev/sda3        19G  4.2G   14G  24% /home
/dev/sda5        19G  3.3G   15G  19% /usr/local
/dev/sda6        19G  3.3G   15G  19% /opt
/dev/sda7        19G  663M   17G   4% /var/lib/mysql
/dev/sda8        92G   46G   42G  52% /var/lib/virtual
/dev/sda9        92G   12G   76G  13% /spares
(this machine is a single drive).

I do a "clean install." When adding partitions during setup I add swap then add root both of which I select YES for format. As I add the other partitions, I select NO for format. The root is "wiped clean," nothing else is lost on any partition.

Before doing the install, though, I copy the /etc tree to /spares/etc. I copy /var/www to /spares/var/www. By so doing, I have everything needed to come back up and running (both users and web pages), and a clean root.

I simply log in as root on the new install, copy /spares/etc/passwd, /spares/etc/shadow and /spares/etc/group. I also copy (because I use KornShell rather than BASH) /spares/etc/profile.d/ksh.sh. Finally, I copy /spares/etc/fonts/local.conf which points to font directories in /usr/local/share/fonts.

Start to finish? 'Bout 20-30 minutes depending on coffee and smoke breaks.

On machines that have VitrualBox, reinstall it. On machines that have OpenOffice, reinstall that (it goes in /opt, not in the root). Get into /etc/httpd and diff httpd.conf (and the content of /etc/httpd/extra) and either just copy it from /spares or do a little editing. Web page stuff up and going.

Get into /usr/local/packages/src and recompile a bunch of SlackBuilds.org stuff (to get the "right" libraries in the new release) and install those (they install mostly in the root tree except for the ones I modify to install in the /usr/local tree. Another hour or so.

All the user accounts are untouched, work just fine. All the applications being used work just fine. The web applications work just fine (I was so happy to find that all I had to do was chmod 755 /etc/rc.d/rc.mysqld and the data bases started up nicely). The PostgreSQL data bases start up just fine, life is good.

This works for me -- it's fast, it's effective and it's not a lot of screwing around. I have two 64-bit boxes and two 32-bit and I do one then copy pretty much everything to the other box without having to do the above again. scp is a wonderful tool

Hope this helps some.

Last edited by tronayne; 11-28-2013 at 09:43 AM.
 
Old 11-30-2013, 07:42 PM   #15
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,860

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
Quote:
Originally Posted by arubin View Post
So it seems if I am to understand Didier Spaier's reply ( thanks but the sarcasm was unworthy of you )
What? You're not too busy to read the man page? I mean, that's the only way his comment would be sarcastic.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add new users if user_list is used for maintaining the users in vsftpd(centos) SarahGurung Linux - Newbie 10 05-29-2012 11:18 PM
[SOLVED] Upgrading Slackware 12.2 kernel - Slackware can no longer "see" ethernet card. madsovenielsen Linux - Newbie 21 07-23-2011 08:08 PM
maintaining slackware and dropline patched/upgraded zelgadis Slackware 3 02-13-2005 10:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration