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!
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:
sudo apt-get install sux
sudo sux www-data
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 simplysux www-data
.