Solved

chown, environment variable and login script

Posted on 2009-05-14
3
451 Views
Last Modified: 2013-12-16
Hello,

I'm currently using gconf to lock settings to my domain users. I've created a user from which I want to copy all the icons in his desktop to my domain users desktop when they log on.To do so, I configured /etc/gdm/PreSession/Default and added the following lines :

cp -R --no-preserve=ownership /home/profil/Bureau/* $HOME/Bureau/
chown -Rv $USER:$USER $HOME/Bureau/*

Bureau means Desktop in french by the way :). This stuff works but only for local user. When I log on using a domain user, I get the following permissions on the file :
-rwxr-xr-x 1 root   root         2426 2009-05-14 11:42 firefox.desktop
-rwxr-xr-x 1 root   root          475 2009-05-14 11:42 gnome-terminal.desktop
drwxr-xr-x 2 membre domain^users 4096 2009-03-02 16:25 untitled folder

The untitled folder is a folder I've created with the logged in user and not a folder which I copied. If it wasn't for the group domain^users everything would work and since there isn't an environment variable for the primary group I don't know how to modify this line so it would work:
chown -Rv $USER:$USER $HOME/Bureau/*

Any ideas or work around ?

Thanks for your time :)
0
Comment
Question by:tech_ci_sherbe
  • 2
3 Comments
 

Author Comment

by:tech_ci_sherbe
ID: 24386416
Forgot to mention that I don't want to use a 3rd party program to do this like sabayon :) I want to be able to script it.
0
 
LVL 4

Accepted Solution

by:
amrox earned 500 total points
ID: 24389203
Why can't you set the group using the gid?
do an ls -n of your Bureau, and note down the number, then in your script:
GID=<number>
chown -Rv $USER:$GID $HOME/Bureau/*
0
 

Author Comment

by:tech_ci_sherbe
ID: 24389816
Wow thanks this is EXACTLY what I was looking for. Didn't know we could do that, I may look like a guru but I'm not :P

Thanks again, I love you <3
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now