Solved

chown, environment variable and login script

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trying to make SNMP connection work 7 65
Adding more CPU cores to a Linux VM 5 62
Choosing CentOS 16 56
Linux VM 6 48
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

920 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

11 Experts available now in Live!

Get 1:1 Help Now