LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-28-2007, 08:30 AM   #1
shobhit
Member
 
Registered: Sep 2003
Location: kolkata
Distribution: Fedora 7
Posts: 60

Rep: Reputation: 15
login without using .profile


Have a very simple problem, which maybe someone has already encountered and resolved.
Is there anyway you can login to a box, with a user id, without executing its .profile file.
 
Old 05-28-2007, 09:31 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
No. You can, however, modify .profile to ask the user whether he wants to do the stuff therein. With some C programming skills, you can even get .profile to even time out, so that if the user doesn't respond in, say, five seconds, the stuff gets executed anyway.

Hope this helps.
 
Old 05-29-2007, 11:03 PM   #3
shobhit
Member
 
Registered: Sep 2003
Location: kolkata
Distribution: Fedora 7
Posts: 60

Original Poster
Rep: Reputation: 15
This sounds promising.
Can you further elaborate on this.
I am fairly good in C and shell, so I may be able to do what is needed.
But I need to know what I need to do :-)
 
Old 05-31-2007, 05:24 PM   #4
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
This seems to be divided into two parts.

The first part is to modify file .profile so that it asks the user whether he wants to execute its content.

The second part is to modify that so it times out after so many seconds, and just goes ahead and does the script.

Since you're familiar with bash scripts, use the if and read statements to get what you need. If you need to get even more familiar, google for this:

Code:
bash script tutorial
You'll find a host of resources there.

When you have that working, if you wish to push along to the part where response timeout is involved, you'll probably have to do something more advanced. I'd recommend C for that, especially since you're already familiar with it. I'd be happy to help you with that once you have the basic stuff done in the script.

Hope this helps. Have fun!

Last edited by wjevans_7d1@yahoo.co; 05-31-2007 at 05:27 PM.
 
Old 05-31-2007, 08:01 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,606

Rep: Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445
1. why would you not want to run the .profile??
2. .profile is for the ksh shell; do you mean .bash_profile (bash shell)?
 
Old 06-01-2007, 06:22 AM   #6
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 960

Rep: Reputation: 35
try logging on a sombody elce, (their profile gets used) the su to whatever user you want

i regually do this to remotly log on to some old unix boxes at work with telnet so that the .cshrec does not get run as for the main user it tries to start a system, which you ahve to be at a graphical login to use, and so gives you and error and tehn logs you out
 
Old 06-01-2007, 12:14 PM   #7
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
As to the name of the file in question, I quote from the O'Reilly bash book by Cameron Newham and Bill Rosenblatt:

Quote:
bash allows two synonyms for .bash_profile: .bash_login, derived from the C shell's file .login, and .profile, derived from the Bourne shell and Korn shell files named .profile. Only one of these three is read when you log in. If .bash_profile doesn't exist in your home directory, then bash will look for .bash_login. If that doesn't exist it will look for .profile.

One advantage of bash's ability to look for either synonym is that you can retain your .profile if you have been using the Bourne shell. If you need to add bash-specific commands, you can put them in .bash_profile followed by the command source .profile. When you log in, all the bash-specific commands will be executed, and bash will source .profile, executing the remaining commands.
 
Old 06-01-2007, 10:53 PM   #8
shobhit
Member
 
Registered: Sep 2003
Location: kolkata
Distribution: Fedora 7
Posts: 60

Original Poster
Rep: Reputation: 15
I see wjevans_7d1@yahoo.co's point, about putting the whole of .profile in an if condition. But I think I did not make the problem clear. What if my .profile contains 'exit' in it. I get thrown out as soon as I login!!!!
Getting root to modify my .profile is an option, is there something else?

A little clarification I am working in ksh and not bash, so .profile is what I want.
 
Old 06-02-2007, 12:39 PM   #9
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
If that really is your situation, that you're running ksh and your .profile is executing an exit so you can't get all the way logged in, I can think of only one way to avoid going to a root guy to fix this. If you're working in a company whose system administrator is kinda testy, you might want to do just this:

Go to a friend who has a different account. Explain the situation. Ask him to log in to his account, do a

Code:
su fred
at the shell prompt, and then ask him to

Code:
cd home_directory_of_fred
mv -i .profile old_profile
and then ask him to exit twice.

You'll need to give him your password, so change it when you're done.

Hope this helps.
 
  


Reply


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
Login Profile jonty_11 Linux - General 6 10-28-2004 05:17 PM
Login profile option Bebo LQ Suggestions & Feedback 1 10-19-2004 08:41 AM
about the login profile ust Linux - Software 2 02-02-2004 09:43 PM
Where to find .profile or .login? sceadu Linux - Newbie 2 03-21-2003 12:06 AM
.profile .login albean Linux - Newbie 4 10-04-2002 08:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:01 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration