Do not allow bypassing users .profile


 
Thread Tools Search this Thread
Operating Systems AIX Do not allow bypassing users .profile
# 29  
Old 03-18-2015
@Don Cragun: Unfortunately I cannot use rlogin because our security department said that rlogin contains security vulnerabilities which can be exploited so we had to disable the service from our servers. Anyway reading your last post I still think that this will not prevent users from doing what they tried to do before. Even if I remove putty from their PCs and give them a different tool to connect on server, nothing stops them from download putty and use it. and if they do that it doesn't matter what kind of shell they are using. Even if I set their initial shell to /bin/myscript as long as they have putty they can still execute remote ssh command and run bash with --noprofile option.

@XrAy: Thank you for your reply. well I'm actually testing all the suggestions that people posted here. this is what I said that I will do and this is what I'm doing right now. I didn't focus in just one thing. I'm trying to see what is the best solution to implement or even a combination of things. this is what I found until now:
  1. Obviously when I create a custom base version of bash solves the problem of remote execution of --noprofile command. but as you said I have to be alert that every time I need to upgrade bash I need to have in mind that I will still exclude the --noprofile option.
  2. ForceCommand is doing a great job on sshd_config. I find out that when I use this option it solves all the issues that I faced.
    1. The user cannot execute the bash --noprofile option even with the original version of bash
    2. The user cannot do sftp and ssh to server and get command line
    3. The user cannot use scp to send or receive files from server.
  3. I couldn't make /etc/profile modification work.
I test it for one user but it doesn't seem to work. The user can still execute the remote command he wants through putty and can connect through sftp and use scp also.

Last edited by rbatte1; 03-18-2015 at 07:44 AM.. Reason: Broke up a single block of text, added LIST=1 & LIST=a tags, spelling, capital letters, apostrophes, bold for command names and ICODE tags for options etc.
# 30  
Old 03-18-2015
Quote:
Originally Posted by omonoiatis9
well actually it doesnt matter what kind of shell you assign to the users. thats why i started this discussion in the first place. for example the user that tried the command to connect to the server and get command line his shell is ksh. but through putty he has the ability to pass a command to the server and choose to run bash shell and use the --noprofile option. so even if i change the login shell of the user he can still do the same.
No. The user's shell - in your example ksh - is still used to run the command passed. Change a user's shell to "/bin/false" and see if you can still run arbitrary commands with that user via ssh.
# 31  
Old 03-18-2015
Well if you set /bin/false as the initial shell for a user of course he will not login. The point is that the user can connect to the server through this shell but not get to command line. And before you mention anything about restricted shells I also tried it with rksh and the user can still bypass his .profile and get command line.

Last edited by rbatte1; 03-18-2015 at 09:10 AM.. Reason: Spelling, capital letters and highlighting commands again.
# 32  
Old 03-18-2015
Quote:
Originally Posted by omonoiatis9
Well if you set /bin/false as the initial shell for a user of course he will not login. The point is that the user can connect to the server through this shell but not get to command line. And before you mention anything about restricted shells I also tried it with rksh and the user can still bypass his .profile and get command line.
You're too fixated on preventing a user from "bypassing his .profile".

You can't stop that. And you can't control what's in a user's .profile in the first place.

And even if a user gets to a command line, he can't perform any operations he couldn't perform without command line access.

Operations on objects such as files or directories are done by system calls to the kernel. Whether they're allowed or not depends on the operation and the permissions given to that object for the user making the system call. WHERE that system call comes from is irrelevant. The kernel doesn't care if it comes from the bash or the boogersnot executable.

You can't really give someone a little bit of a login, although you can use a restricted shell to restrict things somewhat.
# 33  
Old 03-19-2015
Well I think you are missing the point of the whole thread. These users existed on the system for a really long time and nobody has access to command line. NOBODY. They just login to the server and go straight to the application. They exit the application and their sessions is closed.

Recently we noticed that if a user uses putty to connect to the server he can run a remote command to the server and call bash shell (which is not their default shell) with --noprofile option. and in all these pages of the thread a lot of ideas came to the surface. In my previous posts I stressed the fact that I am trying to test what the people suggested in order to find out what suits my situation better, so creating a custom based version of bash obviously solves the specific problem but as you said and as XrAy said you need to be alerted every time you make upgrade of bash shell in order to remove this option from it and I also said that if you enter some lines in sshd_config file in order to force the execution of a specific command for a user or a group of users it works!

It doesn't work only for ssh login, it works also when the user tries to sftp or scp. So I guess that there is a way after all to prevent a user do what he wants to do. After all this should be the way. If you are the administrator then you should force your way to the users because if you allow them do whatever they want they would eventually do some stupid things that will create a mess for you to handle.
Moderator's Comments:
Mod Comment Please consider people reading this thread.
For clarity, please use:-
  • capital letters to start sentences
  • capital letter for first person singular, i.e. I
  • Lower case for everything else, emphasising with underline (capitals are seen as shouting)
  • good paragraphs to break up the post to logical sections, avoiding "... and another thing..."
  • full words, not the way you speak, e.g. because instead of cause
  • highlighting for commands/options or member names
It would make it much clearer to read than a single long unformatted paragraph.

If you make your needs and attempts clear then you are more likely to get better responses and this thread will be more useful to others in the future.

Last edited by rbatte1; 03-19-2015 at 07:47 AM.. Reason: Grammar, spelling, breaking up one long paragraph etc. and moderator comment
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Create a new user from using existing users profile

Hello, Just wanting to know if it is possible. Also I am new to command line. I am running 5.1b, if that matters. Thanks in advance (10 Replies)
Discussion started by: bcha
10 Replies

2. Solaris

Remove a given profile from a users account

Hi Guys, I was studying RBAC and I gave a profile to a user . I have not seen anywhere that shows how to remove the profile from the users account. Can anyone show me how to remove a given profile from a users account? Thanks alot guys. (2 Replies)
Discussion started by: cjashu
2 Replies

3. IP Networking

Bypassing My Company Firewall!

Hi! My organization has put a Firewall which eat up a lot of important data access. So I came to know about SSH Tunneling to bypass the Firewall. I will have to setup a free access SSH server to tunnel data access through PUTTY or OpenSSH. The problem is that I don't know about any free... (1 Reply)
Discussion started by: nixhead
1 Replies

4. Shell Programming and Scripting

Users who desire to have their .profile executed must explicitly do so in the crontab entry. Why?

The .profile file should be read when the user logs in. So, there should be no need to execute .profile file again in a cron job (since the cron job is run after the user logs in). Doesn't the cron require login from the user. Then, from where does the cron execute? Please help!! (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

5. UNIX for Advanced & Expert Users

Bypassing blocking of websites...

So my workplace uses websense to block certain websites. I read while researching firesheep, that you can somehow bypass that by creating a proxy, and thus: #1 protect yourself from people using firesheep (if using unsecure hot-spot) and #2 or visit un-approved websites at work. I... (1 Reply)
Discussion started by: zixzix01
1 Replies

6. Shell Programming and Scripting

sourcing .profile for other users

Hi Team, Thank you for your time. i have a situation where the user IDs of the applicatio users have been locked down to Read only. Hence I am writing a script to invoke their old .profile every time they login. My problem is : when i run . $userpath/.profile from within the ksh script... (9 Replies)
Discussion started by: anitha111
9 Replies

7. AIX

SSH and a users .profile

How do I get a command like "ssh Theuser@host date" to execute the /home/Theuser/.profile before executing the "date" command? (5 Replies)
Discussion started by: IL-Malti
5 Replies

8. UNIX for Advanced & Expert Users

How can I get sudo -u <username> to load that users profile on HP-UX

I am running a serverapplication on a HP-UX machine where I need to handle some of the commands as a specified user called "druser". When I log on as this user with the command; sudo -u druser -sit starts an instance of the shell as that user. However, it doesn't load that users .profile from... (1 Reply)
Discussion started by: ukiome
1 Replies

9. AIX

"ksh -" as login shell bypassing .profile

Hi all, I am currently trying to tell /bin/ksh to behave like a login shell. I am invoking it from an interactive shell. In the documentation is stated, that calling it with exec ksh - it should behave like a login shell, work 1st on /etc/profile, ~/.profile and so on. I tried that with... (0 Replies)
Discussion started by: zaxxon
0 Replies

10. Shell Programming and Scripting

users with same .profile

guys i have a unix user (say "x") which is also an application owner ..thru this user i manage most (90 %) of my tasks related to application i.e application down/up,processes stop/start etc..in short i manage my "tuxedo" via this user.. now i want a new user to be created (on my name) which... (7 Replies)
Discussion started by: abhijeetkul
7 Replies
Login or Register to Ask a Question