2

The commands I am/trying to use in terminal are:

sudo /bin/su -c “echo ‘fs.file-max=1000000’ >> /etc/sysctl.conf”
sudo /bin/su -c “echo ‘* soft nofile 1000000’ >> /etc/security/limits.conf”
sudo /bin/su -c “echo ‘* hard nofile 1000000’ >> /etc/security/limits.conf”
sudo /bin/su -c “echo ‘session required pam_limits.so’ >> /etc/pam.d/common-session”

All I’m getting is “permission denied” or no response to the various methods I’ve tried. I’m currently logged into the first and only account on the PC. Any help would be appreciate, just installed this Ubuntu OS last night.

Rinzwind
  • 309,379

2 Answers2

2

You can pipe echo to sudo tee -a to get the same result.

echo 'fs.file-max=1000000' | sudo tee -a /etc/sysctl.conf
echo '* soft nofile 1000000' | sudo tee -a /etc/security/limits.conf
echo '* hard nofile 1000000' | sudo tee -a /etc/security/limits.conf
echo 'session required pam_limits.so' | sudo tee -a /etc/pam.d/common-session

The -a option with tee will append the output to the end of the file. Make sure to use the -a option or you will overwrite the entire file.

Use tee --help for more information.

mchid
  • 44,904
  • 8
  • 102
  • 162
1

All of these can be done as "root". So

sudo -i
{password}
echo "fs.file-max=1000000" >> /etc/sysctl.conf
echo "* soft nofile 1000000" >> /etc/security/limits.conf
echo "* hard nofile 1000000" >> /etc/security/limits.conf
echo "session required pam_limits.so" >> /etc/pam.d/common-session

Also be wary that you are using the wrong quotes in your question.

Example:

$ sudo -i
[sudo] password for rinzwind: 
# echo "fs.file-max=1000000" >> /etc/sysctl.conf
# 
Rinzwind
  • 309,379