Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

chown, environment variable and login script

Posted on 2009-05-14
3
Medium Priority
?
461 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
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…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

916 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