Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Short story

How can set Unity as desktop environment for an user created with Shell?

Long story

On a VM running Ubuntu 12.04 configured as LAMP, I need to use the desktop environment Unity for the user www-data.

I need this to simplify files permission management while developing with PhpStorm, so when I save a file it already has www-data:www-data as group:owner. (maybe there's a better solution than work as www-data in Unity, if yes please tell me)

I couldn't find any automatic way to add an existing user to Unity, maybe I searched with the wrong terms, so I tried a dirty manual way and these are the steps I did, some are optional but useful in my case:

1) changed home directory of www-data from '/var/www' to '/home/www-data':

sudo usermod -d /home/www-data www-data

2) changed shell of www-data from sh to bash:

sudo chsh -s /bin/bash www-data

3) set a password for www-data

sudo passwd www-data

4) since I already had a well configured desktop environment for another user 'ian', I copied existing user 'ian' home dir to www-data home dir, preserving permissions and than changing group and owner:

sudo cp -a /home/ian/. /home/www-data/
sudo chown -R www-data:www-data /home/www-data

5) added www-data to sudoers:

sudo usermod -aG sudo www-data

6) added www-data to the same groups of ian

sudo usermod -a -G cdrom,dip,plugdev,sambashare,lpadmin www-data

7) configured the greeter to show manual login:

sudo echo 'greeter-show-manual-login=true' >> /etc/lightdm/lightdm.conf

8) rebooted the VM

sudo reboot

Actually I can login with www-data and I have the same desktop environment as user ian but I can't see www-data in the list of available users of the greeter and also in the list of 'User Accounts'. Only ian is displayed.

I also tried to set minimum-uid=0 in /etc/lightdm/users.conf with no luck. I am missing something, any idea?

Thanks!

share|improve this question
    
I found how to let the greeter display www-data. I edited /etc/login.defs and changed UID_MIN from 1000 to 33 (the ID of www-data). But now the greeter displays a lot of users, all those that have id >= 33. I think that there's a better solution somewhere :) –  ianExcedo Jan 29 at 13:53
add comment

1 Answer

up vote 0 down vote accepted

maybe there's a better solution than work as www-data in Unity, if yes please tell me

I'm not sure what you want to do, but if you need to run graphical applications with the www-data user while logged in as another user in a graphical session:

  1. sudo apt-get install sux

  2. sudo sux www-data

  3. launch your graphical applications from this terminal session.

2.b the www-data user's default shell has to be set to one which allows logging in (but you already changed it to such). But you don't have to set or unlock the password for www-data since you use sudo sux www-data, if www-data has a password you can simply sux www-data.

share|improve this answer
    
My main goal was to use an application (PhpStorm) as an user (www-data) different of the one logged in Unity (ian). So this is not exactly the answer to the original question 'Add existing user to Unity' but using sux I could have avoided to create a desktop environment for www-data and so my question wouldn't make sense. It's kinda back time traveling ;) Thank you! –  ianExcedo Jan 30 at 8:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.