LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2018, 08:27 AM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
how to reissue default custom config files to a user account


new user gets default files added,
Quote:
Using /etc/skel

This tip shows you how to use /etc/skel to ensure that all new users on your system get the same initial settings.

The /etc/skel directory is the directory used by useradd to create the default settings in a new user's home directory.

To change the location of /etc/skel, edit /etc/default/useradd.

Code Listing 1

# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel

Typically files included in /etc/skel are .rc files for shell initialization, but you could also include a public_html directory, a custom dircolors file, or anything else.

Code Listing 2

% ls -A /etc/skel
.bash_profile .bashrc .maildir .screenrc .tcsh.config

For more information on customizing /etc/skel see man useradd.

From http://www.gentoo.org/news/en/gwn/20...newsletter.xml
some WM/DT if one deletes their config files logout , login they are then put back as defualt settings.

customizing an install iso where one has custom config files for the dt/wm (mainly openbox) and tint2 and conky.

openbox, (tint2, conky), if config files are deleted they get them back but not the custom ones that a new user gets.

there has to be a way to put them back in on an existing user account if deleted. this is what I am trying to discover and maybe fix for someone else project.

any guidance to what to look at in order to change or add scripts that check for missing files then put the custom ones back in, because they need to be made to supersede the default configs for the actual program.

I am writing this off the cuff, so I might have missed a few details, as always just ask.
 
Old 10-26-2018, 06:53 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Are you wanting to do something more than just copy the files again?
Code:
cp /etc/skel/* /home/someuser/
or only copy the files that are missing...something like (pseduocode/syntax may not be correct)
Code:
for FILE in $(ls -1 /etc/skel/
if [[ ! -a /home/someuser/$FILE ]] ;then 
   cp /etc/skel/$FILE /home/someuser/
fi

Last edited by scasey; 10-26-2018 at 07:01 PM.
 
1 members found this post helpful.
Old 10-26-2018, 07:14 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by scasey View Post
Are you wanting to do something more than just copy the files again?
Code:
cp /etc/skel/* /home/someuser/
or only copy the files that are missing...something like (pseduocode/syntax may not be correct)
Code:
for FILE in $(ls -1 /etc/skel/
if [[ ! -a /home/someuser/$FILE ]] ;then 
   cp /etc/skel/$FILE /home/someuser/
fi
thanks, I found that first part, the if part is nice. thanks again!>
 
  


Reply



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
current Kernel 3.16-2 fails. (custom config, but not default one) Debian jessie i386 kaz2100 Debian 2 10-29-2014 08:51 AM
How can I search for a user account in various sudo related config files? melybee Linux - Newbie 8 06-18-2014 05:36 AM
How to set default file permissions for (custom) Apache log files? Zippy1970 Linux - Server 6 04-02-2014 01:45 AM
default user account & password for SuSE? zeeshan876 Linux - Software 1 02-24-2011 03:55 PM
Can sbdy give config files for gmail account for sending with mutt for a normal user? frenchn00b Linux - Newbie 1 07-24-2007 01:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:06 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