#!/usr/bin/env python import sys import os, os.path import pwd if len(sys.argv) != 4: sys.exit(0) home = sys.argv[1] group = sys.argv[2] user = sys.argv[3] list_files = ['.config' ,'.gconf','.gnome2','.local','.mozilla','.Xauthority','.xsession','.ICEauthority','.bashrc','.bash_logout','.dmrc','.gtk-bookmarks','.lliurex-do','.profile'] for aux_file in list_files: aux_path = os.path.join(home,aux_file) if os.path.exists(aux_path) and ( pwd.getpwuid(os.stat(aux_path).st_uid).pw_name != user ): cmd = "chown -R " + user +":"+group +" " + aux_path os.system(cmd)