chrisname wrote: |
---|
I realise 777 is a bad habit. What is 755? |
the value of each is:
Read = 4
Write = 2
Execute = 1
basically each number in the chmod format stands for this:
user | group | others
(there is 1 other unit but is more commonly omitted)
so the user is the users permissions (the person who owns the file(typically you), to check this use list long format(
ls -l )), groups are things in linux that basically work like certain groups have certains permissions etc. I dunno how to explain it fully, but basically each user has a group, typically if your the owner and admin of the OS, then your group is the same as your username, however on large unix system you may have 1 group for level1 people, then another group for level2 etc. Additionally each program on the system has it's own group as well. This is to allow certain users to use certain programs.
others is everyone else, eg. people over network etc...
if we want to put read/write/exec on user 7
if we want to put read/exec on group and others then 5 = 4 + 1
so the format looks like this:
1 = execute
2 = write
3 = write / execute (2+1)
4 = read
5 = read / execute (4+1)
6 = read / write (4+2)
7 = read / write / execute (4+2+1)
typically 755 is normal, or 754 imo it's up to you... doesn't matter too much. keep in mind some files don't need execute permissions.
additionally files beginning with a dot ( . ) are hidden files, these are not shown using ls, or in normal GUI folder view. You need to specify to show hidden files, or use list with the "show all" flag -a :
$ ls -a
helios wrote: |
---|
Wait, doesn't that restrict all operations? 000 would allow all operations. |
there is another command called umask this is usually put into rc files to allow
default permissions on files:
for some silly reason it works backwards to chmod. Don't ask why, I have no idea... it's dumb.
so lets say we want to put a default in our default shell which happens to be bash
in the .bashrc file in our home directory we can put:
# default permissions
umask 022
so before when we would add the number we want to have on the files, this time using umask we must put the numbers(permissions) we
DON'T want on the files.
so in this case all files would be set as default 755
because we have specified 0 for user, 2 for groups, which means groups will not have write, and 2 for others- others don't get write.
chmod 777 = umask 000
chmod 755 = umask 022
chmod 400 = umask 377
Bazzy wrote: |
---|
which java will give you the directory
- just java will run it if it's installed - |
like Bazzy suggested which is a good way of finding programs installed in your system, however it only reports the first entry found.
What I do is put as an alias in my .bashrc
alias which='type -a'
type -a is a much better format as it shows all programs found in your $PATH variable, and also any aliases eg.
$which which
which is aliased to type -a
which is /bin/which
which is /usr/bin/which
which is /usr/local/bin/which
which is /sbin/which
(seems I have a few 'which's installed :P), actually I made up the last 3 entries...
of course you don't need to add this to your rc you can simply type on command line;
$ type -a JVM
or
$ type -a java
java is /usr/bin/java
the find command can also be handy dealing with problems such as these. but typically the problem is people installing OpenJDK
OpenJDK is a piece of shit, uninstall it if you have it installed.
install sun JDK...
it is usually in most repositories just takes a bit more looking for. You could try compiling from source yourself by downloading off the website, but it is
always better for the system to manage your software
I might be hopeless at C++, but I'm pretty good with unix. :P