LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Enterprise Linux > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Tags used in this thread
Popular LQ Tags , , , , , ,

Reply
 
Thread Tools
Old 07-22-2008, 03:34 PM   #1
hijack204
LQ Newbie
 
Registered: May 2006
Posts: 13
Thanked: 0
id -un, whoami in OpenSSH built in jail function


[Log in to get rid of this advertisement]
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...
hijack204 is offline  
Tag This Post , , , , , ,
Reply With Quote
Old 07-22-2008, 04:44 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,511
Thanked: 4
You are missing the passwd file in the chroot tree, or it is not readable by the process.
Mr. C. is offline     Reply With Quote
Old 07-22-2008, 05:10 PM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 23,977
Thanked: 8
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.
trickykid is offline     Reply With Quote
Old 07-22-2008, 05:13 PM   #4
hijack204
LQ Newbie
 
Registered: May 2006
Posts: 13
Thanked: 0

Original Poster
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 05:19 PM..
hijack204 is offline     Reply With Quote
Old 07-28-2008, 01:05 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 16,716
Blog Entries: 30
Thanked: 283
Show us the strace from inside your jail env?
unSpawn is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
chroot jail w/ openssh problems goillini Linux - Security 15 07-14-2008 05:49 PM
warning: incompatible implicit declaration of built-in function ‘bzero’ nasim751 Linux - Software 1 04-16-2008 03:35 AM
warning: incompatible implicit declaration of built-in function ‘exit’ xzotech Programming 1 08-14-2005 06:43 AM
question about strtok_r built-in function in C Linh Programming 4 05-14-2004 11:33 AM
C built-in function for a Bash script Linh Programming 3 04-23-2004 10:23 AM


All times are GMT -5. The time now is 11:03 AM.

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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration