def chuid(name, uid):
 if (not isinstance(uid, int)):
  raise SaltInvocationError('uid must be an integer')
 pre_info = info(name)
 if (not pre_info):
  raise CommandExecutionError("User '{0}' does not exist".format(name))
 if (uid == pre_info['uid']):
  return True
 _dscl(['/Users/{0}'.format(name), 'UniqueID', pre_info['uid'], uid], ctype='change')
 time.sleep(1)
 return (info(name).get('uid') == uid)

def chuid ( name , uid ) : if ( not isinstance ( uid , int ) ) : raise SaltInvocationError ( 'uid must be an integer' ) pre_info = info ( name ) if ( not pre_info ) : raise CommandExecutionError ( "User '{0}' does not exist" . format ( name ) ) if ( uid == pre_info [ 'uid' ] ) : return True _dscl ( [ '/Users/{0}' . format ( name ) , 'UniqueID' , pre_info [ 'uid' ] , uid ] , ctype = 'change' ) time . sleep ( 1 ) return ( info ( name ) . get ( 'uid' ) == uid )
change the uid for a named user cli example: .