Find ulimit -a for other users

gr8odinsraven picture gr8odinsraven · Aug 14, 2014 · Viewed 42.7k times · Source

Is anyone aware of a way to find the "ulimit -a" values for another user in Linux? I want user A to be able to check User B's ulimit values. Assumptions are the User A and User B are non-root users.

Thanks in advance

Answer

Pancho picture Pancho · Dec 21, 2015

If I am understanding correctly, you are wanting to achieve something like the following...

Assuming I am root and I would like to find out the soft limit information configured for the user fred, the following approach:

su - fred -c "ulimit -Sa"

will return the desired values.

Alternatively, if as per your question, you are not root, then you could use sudo and if desired inject the necessary password on execution as shown here

echo "freds password" | sudo -Siu fred ulimit \-Sa