Tag Archives: UID

Script to pull uid greater than 1000 from remote server

By bobby320

Hello,

I am trying to get UID # greater than 1000 from all linux server, I tried this script getting this error message, someone please suggest.

Code:

$for i in `cat hostlist.0709.org` ; do ssh -t $i 'awk -F':' "{ if($3 >= 1000) print $0 }" /etc/passwd ' >> output ; done
$ cat output
hostname1
awk: { if( >= 1000) print bash }
awk: ^ syntax error
$


Thanks,

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Can't chgrp. Error – chgrp: changing group of `<file>': Invalid argument

By venmx

I found that I cannot chgrp for some reason with error:

chgrp: changing group of `’: Invalid argument

This happens on all NFS mounted disks on client machines.

We use AD (not my call) for authentication and it also provides groups.

We have a NFS server running Scientific Linux 6.3 which mounts SAN devices on FC connect. These are then exported via NFS. Clients are all CentOS 6.4.

The clients hard mounts the user’s home disk with intr,sync and various tuning options. The other disks use autofs.

AD is configured so that each user has a matching UID and GID, essentially making them the exclusive member of their own group. Not useful for sharing files unless you don’t mind making all your files accessibly by world, o+.

We need groups so that we can add members who are then able to chgrp what ever files they’d like to share with members of the same group. All seems pretty straight forward so far.

I used to run OpenLDAP with Kerberos to do all this, I had LDAP manage autofs and groups. Everything worked perfectly.

But now I cannot chgrp.

The permissions of the exported directories on the NFS server are:
drwx–x–x root root /san/home
drwxrwxrwx root root /san/otherdisks

But under home each user directory is owned by the user:
drwx–x–x user1 user1 /san/home/user1

NOTE: “other” means machines within same organization using same AD but built by other departments, “this” means the machines I built.

In the following scenarios it fails:

1. As AD user on “this” client machine on own home on “this” NFS server.
2. As AD user on “this” client machine on automounted disk on “this” NFS server.
3. As root on “this” client machine on automounted disk on “this” NFS server.

In the following scenarios it works:

1. As AD user on “this” client on local partitions where permissions allow.
2. As AD user logged in directly on “this” NFS server on any partition where permissions allow, including on SAN disks.
3. As root on “this” file server on any partition.
4. As AD user on “other” clients on export from “this” NFS server.
5. As AD user on “other” clients on export from “other” NFS server.
6. As AD user on “this” client on export from “other” NFS server.

This issue shows itself when I extract TAR files whilst on client machines to NFS exported shares as AD user or root, can’t chgrp!

I can do everything else, I can create, delete, even do newgrp and change my default group then create new files belonging to me with GID of new group. But still can’t chgrp

From: http://www.unix.com/red-hat/221091-cant-chgrp-error-chgrp-changing-group-file-invalid-argument.html

Gerfried Fuchs: Backports Integrated Into The Main Archive

Flattr this

Dear users and supporters of the backports service!

The Backports Team is pleased to announce the next important step on getting backports more integrated. People who are reading debian-infrastructure-announce will have seen that there was an archive maintenance last weekend: starting with wheezy-backports the packages will be accessible from the regular pool instead of a separate one, and all backports uploads will be processed through the regular upload queue (including those for squeeze-backports and squeeze-backports-sloppy).

For Users

What exactly does that mean for you? For users of wheezy, the sources.list entry will be different, a simple substitute of squeeze for wheezy won’t work. The new format is:

deb http://ftp.debian.org/debian/ wheezy-backports main

So it is debian instead of debian-backports, and offered through the regular mirror network. Feel invited to check your regular mirror if it carries backports and pull from there.

For Contributers

What does it mean for contributing developers? Uploads for backports are no longer to be pushed to backports-master but to ftp.upload.debian.org, like any other regular package. Also, given that the packages are served from the same archive install there is no need to include the original tarball in the upload any longer because the archive knows it (Squeeze and beyond).

Also, given that the upload goes to the same upload queue, there is only one keyring used anymore, so no more pain with expired or replaced keys. We though still keep the rule of adding your UID to an ACL list (this also includes DM additions). This is mostly only to give us the chance to remind you that uploads to backports are directly available for installation onto stable systems and you thus should take special care there. We carefully tried to take over the old ACLs, in case you can’t upload anymore, please tell us so we can look into the issue.

I’ve mentioned wheezy-backports (and squeeze-backports-sloppy) a few times here already, and you might wonder when it will be available. Technically, it is available from now on. Practically, while you could already upload to it, the set up of the buildd network is more painful than expected, so please allow the Buildd Team some days for setting them up.

The upload rules for wheezy-backports are the same: packages that are in the next suite are accepted. Given that Jessie isn’t created yet, we want you to think about whether the package you want to upload will go into Jessie final, and that you are taking a closer look once Jessie is created and the package entered there about the upgradeability. For the time until the suite is available, you can see this as relaxed upload rule.

The same goes for squeeze-backports-sloppy: packages from two suites after Squeeze are acceptable, which turns it into the same relaxed rule as wheezy-backports above. Please also keep in mind that uploads to squeeze-backports-sloppy usually should be accompanied by uploads to wheezy-backports so people are able to upgrade from squeeze-backports-sloppy to wheezy with wheezy-backports.

Thanks

Finally, we want to thank …read more
Source: FULL ARTICLE at Planet Ubuntu

Dealing with white spaces in bash scripts

By venmx

I’m trying to search for all files in directory with particular GID then change the GID to match the UID of each file:

Code:

#!/bin/sh

for i in $(find /dump -gid 200 | sed 's/ /\ /g' | sed 's/&/\&/g'); do
chgrp $(ls -ln ${i} | awk '{print $3}') ${i}
done


I’m using sed to deal with spaces and special characters.

I get a clean output from the find command when run on its own; I also get the desired result when I run chgrp and substitute a line from output of find into each instance of variable ${i}.

But when I run the script, I get many errors and not all the files/directories have been chgrp as desired.

Here’s an excerpt of the errors I’m seeing:

Code:

chgrp: missing operand after `/dump/aaa36/.evolution/memos/config'
Try `chgrp --help' for more information.
chgrp: missing operand after `/dump/aaa36/.evolution/calendar/config'
Try `chgrp --help' for more information.
chgrp: missing operand after `/dump/aaa36/.evolution/tasks/config'
Try `chgrp --help' for more information.
chgrp: missing operand after `/dump/aaa36/.evolution/cache'
Try `chgrp --help' for more information.
ls: cannot access /dump/aaa36/untitled: No such file or directory
chgrp: missing operand after `/dump/aaa36/untitled\'
Try `chgrp --help' for more information.
ls: cannot access folder: No such file or directory
chgrp: missing operand after `folder'
Try `chgrp --help' for more information.
ls: cannot access /dump/aaa36/untitled: No such file or directory
chgrp: missing operand after `/dump/aaa36/untitled\'
Try `chgrp --help' for more information.
ls: cannot access folder/neutron_EDM.pdf: No such file or directory
chgrp: missing operand after `folder/neutron_EDM.pdf'
Try `chgrp --help' for more information.


Please tell me what I’m doing wrong?! Thanks 🙂

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Set permissions for new files created by application

By s_linux

Hello All,
I have an application that creates the log files and they created with 600 permissions instead of 644(default). How can I set the permissions so that files can be created with 644. I looked into the /etc/profile for the umask settings and it is set 002(if UID>199). And when I type umask I get “0022”. Also permissions are resetting to 600 on log rotation if I change the permission to 644 manually.
I just tried, when I login with root and create file manually, it creates with 644. Could some one help me out. I wanted to create the files with 644 and shouldn’t change. Thanks.

Source: FULL ARTICLE at The UNIX and Linux Forums

Chown… cannot get the login group of a numeric UID

By lutus

How do I resolve the below error. I want to change the ownership on sf_Temp file from media to dba.

[root@localhost media]# grep ^media /etc/group

[root@localhost media]# ls -l
drwxrwx— 1 root vboxsf 0 Feb 1 16:10 sf_Temp
drwxrwx— 2 root vboxsf 4096 Jan 31 17:59 sf_VBoxShared
dr-xr-xr-x 6 oracle root 2048 Dec 19 09:20 VBOXADDITIONS_4.2.6_82870
total 10

root@localhost media]# chown dba: vboxsf sf_Temp
chown: `dba:’: cannot get the login group of a numeric UID

Source: FULL ARTICLE at The UNIX and Linux Forums

Equivalent uid to root

By abohmeed

Hi all
I have a strange problem on one my my AIX machines. We have created a user called testroot with the same UID as root (uid=0) by changing the uid of that user in the /etc/passwd file. I know that this is a security breach but this is a test system.
Now the strange thing that happens is that when i run

Code:

su -


to get the root prompt and then run

Code:

id


the command says that the id of the current user is testroot and NOT root, although having a uid of 0.
Strange enough, when i try to do some root tasks with that user like changing the password of another user on a HACMP cluster i am faced with an error message that only root can do this.
To my surprise, now even if i log on to the system with username root and the root password and run

Code:

id


it says that i am logged in as testroot!
Of course the only solution to this problem was to change the uid of that user to something else to regain my root privileges.
But still this is a very weird problem. Does anybody have a clue why this behavior occurs?
Thanks a lot in advance

Source: FULL ARTICLE at The UNIX and Linux Forums