Cannot "chmod" after account migration on openBSD. | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Cannot "chmod" after account migration on openBSD.

UNIX for Dummies Questions & Answers


Tags
account, chown, passwd, solved

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-13-2013
cyberking cyberking is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 18 March 2013, 12:35 AM EDT
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
[Solved] Cannot "chmod" after account migration on openBSD.

I copy home directory, file /etc/passwd, file /etc/group, file /etc/master.passwd
to the new server.

This is result of "ls/home" on the old server.

Code:
drwxr-xr-x   3 user1          user1                512 Aug  3  2012 user1
drwxr-xr-x  19 user2          user2               2560 Jan  9 09:24 user2

But This is result of "ls/home" on the new server.

Code:
drwxr-xr-x   3 root          wheel                512 Aug  3  2012 user1
drwxr-xr-x  19 root          wheel               2560 Jan  9 09:24 user2

I would like to change root:wheel to user1:user1

This is result of
Code:
chmod user1:user1 user1
chown: user is invalid: user1

Although user1 has been stored in /etc/passwd

Any idea?
Thank you in advance.

Moderator's Comments:
edit by bakunin: Please use CODE-tags.

Last edited by bakunin; 03-13-2013 at 07:13 AM..
Sponsored Links
    #2  
Old 03-13-2013
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 17 September 2014, 4:50 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,245
Thanks: 45
Thanked 813 Times in 641 Posts
Quote:
Originally Posted by cyberking View Post
Code:
chmod user1:user1 user1
chown: user is invalid: user1

Although user1 has been stored in /etc/passwd
Depending on the OS you are using there might be a shadow-file: "/etc/security/passwd" (AIX) or "/etx/shadow" (Linux), etc.. When creating/moving a user you should never just copy passwd-entries but use the respective utility: "useradd", "mkuser" or whatever your OS provides.

Just to be sure: you talk about "chmod" and "chown" intermixed. Which one do you have problems with?

I hope this helps.

bakunin
Sponsored Links
    #3  
Old 03-13-2013
cyberking cyberking is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 18 March 2013, 12:35 AM EDT
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bakunin View Post
Depending on the OS you are using there might be a shadow-file: "/etc/security/passwd" (AIX) or "/etx/shadow" (Linux), etc.. When creating/moving a user you should never just copy passwd-entries but use the respective utility: "useradd", "mkuser" or whatever your OS provides.

Just to be sure: you talk about "chmod" and "chown" intermixed. Which one do you have problems with?

I hope this helps.

bakunin
Thank you bakunin. Sorry It's "chown".

Code:
chown user1:user1 user1
chown: user is invalid: user1

I don't want to add new user B'cuz there are a lot of user and they have to change their password or not? And I cannot find shadow file on OpenBSD.

Code:
locate shadow
/usr/X11R6/include/xorg/shadow.h
/usr/X11R6/include/xorg/shadowfb.h
/usr/X11R6/lib/modules/libshadow.la
/usr/X11R6/lib/modules/libshadow.so
/usr/X11R6/lib/modules/libshadowfb.la
/usr/X11R6/lib/modules/libshadowfb.so

    #4  
Old 03-14-2013
alister alister is offline
Registered User
 
Join Date: Dec 2009
Last Activity: 11 June 2014, 8:40 PM EDT
Posts: 3,231
Thanks: 179
Thanked 974 Times in 790 Posts
If you inspect the chown source, you'll see that it uses getpwnam(3) to convert the username to a uid. That function reads the binary database files /etc/spwd.db and /etc/pwd.db. Did you rebuild those? If you don't know what I'm talking about, refer to man pwd_mkdb .

It's safest to make edits to the password files using vipw. As always, if you break it, you get to keep all the pieces.

Regards,
Alister

Last edited by alister; 03-14-2013 at 12:56 AM..
The Following User Says Thank You to alister For This Useful Post:
cyberking (03-14-2013)
Sponsored Links
    #5  
Old 03-14-2013
cyberking cyberking is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 18 March 2013, 12:35 AM EDT
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Thank you all. It's solved.
I use this command

Code:
/usr/sbin/pwd_mkdb -p /etc/master.passwd

Moderator's Comments:
edit by bakunin: thanks for the follow-up. Changed the thread title to "solved".

Last edited by bakunin; 03-14-2013 at 03:21 AM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
chmod on a remote server -solved in5ane UNIX for Dummies Questions & Answers 0 03-24-2011 01:54 PM
What is the difference between chmod in solaris and chmod in Linux? sumaiya UNIX and Linux Applications 1 08-12-2010 08:38 AM
Apply disk quota to account(dedicate 3 GB to account). ashokd009 Linux 1 06-17-2009 11:32 AM
Change Account to not lock account if password expires stringzz UNIX for Dummies Questions & Answers 1 04-04-2008 05:31 PM



All times are GMT -4. The time now is 07:35 PM.