LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-23-2010, 12:59 AM   #1
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Rep: Reputation: 16
Question Can not change "ulimit -n"


I want to change number of open files. Currently:
Code:
mahmood@localhost:~$ ulimit -n
1024
I can not change it neither in user nor sudo modes:
Code:
mahmood@localhost:~$ ulimit -n 8192
-bash: ulimit: open files: cannot modify limit: Operation not permitted
mahmood@localhost:~$ sudo ulimit -n 8192
sudo: ulimit: command not found
So how can I change that?
 
Old 08-23-2010, 02:04 AM   #2
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
in most systems you can't change it via command line.
see if you have the file

/etc/security/limits.conf

then append what you want like:

mahmood soft nofile 8192
mahmood hard nofile 101062
 
Old 08-23-2010, 02:35 AM   #3
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by born4linux View Post
in most systems you can't change it via command line.
I still can change via command line (tested with CentOS, Gentoo).

@mahmoodn: su - to root and try again.
 
Old 08-23-2010, 02:44 AM   #4
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by born4linux View Post
in most systems you can't change it via command line.
see if you have the file

/etc/security/limits.conf

then append what you want like:

mahmood soft nofile 8192
mahmood hard nofile 101062
Thanks it works
Quote:
@mahmoodn: su - to root and try again.
It doesn't work on ubuntu:
Code:
mahmood@localhost:~$ su -
Password: 
su: Authentication failure
mahmood@localhost:~$ sudo uname -a
[sudo] password for mahmood: 
Linux saturn 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:22:14 UTC 2010 i686 GNU/Linux
 
Old 08-23-2010, 03:16 AM   #5
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by mahmoodn View Post
It doesn't work on ubuntu:
Code:
mahmood@localhost:~$ su -
Password: 
su: Authentication failure
mahmood@localhost:~$ sudo uname -a
[sudo] password for mahmood: 
Linux saturn 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:22:14 UTC 2010 i686 GNU/Linux
I guess you didn't set password for root. After typing 'su -' you must enter the password of root, not mahmood.
 
Old 08-23-2010, 05:02 AM   #6
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
I have only one password. How can I set a password for root?
what is the difference between "su -" and "sudo"? Although my problem is now solved but I would like to now that.
 
Old 08-23-2010, 05:33 AM   #7
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS6
Posts: 267

Rep: Reputation: 57
"su -" means substitute user using root (as no user is specified) as the user and root's environment (-).
This command is used to substitute another user for the current user. A new shell is started and you will need to enter the new user's login password (a prompt will provided). The session is then started as if it was a new login.

"sudo <cmd> means substitute the super user to do the following command. Uses the /etc/sudoers file for permissions, etc. You will be prompted for the current user's password if /etc/sudoers requires one. After completion of cmd, you are returned to the current shell with the previous settings.
 
Old 08-23-2010, 05:35 AM   #8
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
Thanks for that. So how can I set a root password while I am logged in as a user?
 
Old 08-23-2010, 05:41 AM   #9
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by mahmoodn View Post
Thanks for that. So how can I set a root password while I am logged in as a user?
Code:
sudo passwd root
Another 'dirty' way to switch to root is 'sudo su -'
 
Old 08-23-2010, 05:42 AM   #10
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
Thanks it works
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache rewrite rule to change any "&" to "%26" d1s4st3r Linux - Server 1 02-25-2010 10:01 PM
Fedora Core 2: Screen Resolution can not change from "800X600" to "1024X 768" suhaimi_sj Fedora - Installation 18 12-17-2009 03:29 AM
how can i change my vga driver from "vesa" to "savage" mojarron Slackware - Installation 1 03-24-2005 11:03 PM
how can i change my vga driver from "vesa" to "savage" mojarron Slackware 1 03-24-2005 07:16 AM
Can you change the "title" under your name that says "member" or "newbie&qu Whitehat LQ Suggestions & Feedback 3 11-19-2003 06:32 PM


All times are GMT -5. The time now is 06:21 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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration