Solved

chown, environment variable and login script

Posted on 2009-05-14
3
455 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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