Solved

chown, environment variable and login script

Posted on 2009-05-14
3
454 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
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…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

820 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