#!/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','.pulse','.bash_history','.cache','.gvfs','.pulse-cookie','.esd_auth','.font-config','.hydrogen','.solfegerc'] for aux_file in list_files: aux_path = os.path.join(home,aux_file) if os.path.exists(aux_path) and os.stat(aux_path).st_uid != pwd.getpwnam(user).pw_uid : cmd = "chown -R " + user +":"+group +' "' + aux_path + '"' os.system(cmd)