Results 1 to 6 of 6
Hi all.
I am not sure if my question belong here or to programming section but i guess here is more appropriate place.
I want to make a system (experimental) ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-16-2005 #1Just Joined!
- Join Date
- Aug 2005
- Posts
- 3
Override colons as field separators in /etc/passwd
Hi all.
I am not sure if my question belong here or to programming section but i guess here is more appropriate place.
I want to make a system (experimental) into which as soon as the user connects from an ssh session or from physical console, instead of the standard /bin/bash to have a different shell, java based.
As far as i understand, i must change the appropriate field in the /etc/passwd file or /etc/inittab.
The problem is that both of these files use colon as a field separator and the virual machine requires colon for parameter input (a line like java -Xbootclasspath:something -classpath something:somethingelse). Due to specification's i can't use any type of shell script to load the JVM because no other shell must be loaded. I am trying this in FC2 with 2.4 kernel.
I have read manuals about the /etc/passwd file and /etc/inittab file but didn't find anything to help me. I tried to put the command betwen quotes in /etc/passwd but it started /bin/sh instead and from there tried to run my application. I would like to go directly to application if possible.
I don't need multiuser or login prompt. Any other way besides runing another shell first would be nice.
Does anyone know how to do that? Can someone please give me a clue where to look or any link to any related info?
- 10-16-2005 #2
Assuming that this will work:
Will java program accept an argument which points to a file containing command arguments?Code:/*/*/java -arg data -arg data
Code:/*/*/java -java_command_arguments_file <file specification>
- 10-16-2005 #3Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
So what exactly did you put in the /etc/passwd file?
- 10-16-2005 #4Just Joined!
- Join Date
- Aug 2005
- Posts
- 3
OK people... false alarm
That was my mistake. I gave the full path to where to get the java executable but not where to get the jar file to load.
And after the login the error message dissapeared so fast that
it couldn't be possible to read it so i made the assumption tha it was the colon's fault.
So problem solved and everything works fine now. Thank you for your replies.
- 10-17-2005 #5
And, in the process, it seems that you have shown that Linus was smart enough to write the code to parse the /etc/passwd file in such a way that everything beyond the sixth colon was maintained as a single entry... Cool!
Way to go, Linus!
(As opposed to dividing the line by the colons first, then...)
I have actually never had the occasion or circumstance to try something like this -- I have never needed more than just a shell file specification (with no arguments) -- so, I have never really thought about it -- interesting... I'm glad you brought it up.
- 10-17-2005 #6Just Joined!
- Join Date
- Aug 2005
- Posts
- 3
Yes, i am using linux heavily for around six months now and everyday it amazes me with the small details that heve been taken care.


Reply With Quote
