LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
Search this Thread
Old 07-22-2008, 02:34 PM   #1
hijack204
LQ Newbie
 
Registered: May 2006
Posts: 13

Rep: Reputation: 0
id -un, whoami in OpenSSH built in jail function


I'm working on a rhel5.1 server with OpenSSH version 4.9-5.x installed which has support for jails natively. Now I have the jail working great except I cannot get the commands:
whoami - aka id -un
logname

to work properly inside the jail.. anyone else have this problem? Here is what I have setup in my sshd_conf

Match User jailuser
ChrootDirectory /chroot/jail/
AllowTcpForwarding no

Now i've used nixCraft's nice little script to help me move over library's (http://www.cyberciti.biz/files/lighttpd/l2chroot.txt) and everything else seems to be working fine. Here are a few examples of output I get

#whoami
whoami: cannot find name for user ID 503
#id
uid=503 gid=504 groups=504
#id -un
id: cannot find name for user ID 503
503
#logname
503

So its getting the uid.. but I guess it can't lookup the name...
 
Old 07-22-2008, 03:44 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
You are missing the passwd file in the chroot tree, or it is not readable by the process.
 
Old 07-22-2008, 04:10 PM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Mr. C. is probably correct. I just ran an strace on the whoami command it indeed reads the /etc/passwd file. You'll need this file in order to match the UID with user logged in somewhere in the chroot jail you setup.
 
Old 07-22-2008, 04:13 PM   #4
hijack204
LQ Newbie
 
Registered: May 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Yeah I thought that originally but its appears.. adding passwd shadow or group has no effect =( Maybe a caveat of using openssh's native jail

Last edited by hijack204; 07-22-2008 at 04:19 PM.
 
Old 07-28-2008, 12:05 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,118
Blog Entries: 54

Rep: Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787
Show us the strace from inside your jail env?
 
  


Reply

Tags
chroot, id, jail, openssh, redhat


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
warning: incompatible implicit declaration of built-in function ‘bzero’ nasim751 Linux - Software 3 04-21-2014 03:39 AM
chroot jail w/ openssh problems goillini Linux - Security 15 07-14-2008 04:49 PM
warning: incompatible implicit declaration of built-in function ‘exit’ xzotech Programming 1 08-14-2005 05:43 AM
question about strtok_r built-in function in C Linh Programming 4 05-14-2004 10:33 AM
C built-in function for a Bash script Linh Programming 3 04-23-2004 09:23 AM


All times are GMT -5. The time now is 08:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration