![]() |
Unix
style permissions generator:This is a form to generate the values used for chmod in a unix type os (like Linux, FreeBSD, Solaris), for setting permissions on files, usually files in the cgi-bin directory. This took me like forever to get a real handle on, so hopefully this will help someone else see it more quickly. Chmod usage is like: username@hostname$ >chmod 755 /home/httpd/cgi-bin/somefilename.cgi
Where somefilename.cgi is the file you want to adjust permissions on. It's usually most effective to set permissions as high as possible, then adjust them downward (for more security) as you test/debug your installation. I'd like to have found a way to loop through the subtotals more elegantly-- meaning less typing, but wtf, it works.
<script language="JavaScript">
<!-- hide from old browser//
function addUp() {
var form = document.form
var perms = 0
var oPerms = 0
var gPerms = 0
var aPerms = 0
for (var i = 0; i < 9; i++) {
if (form.elements[i].checked)
perms += parseInt(form.elements[i].value)
}
}
//////////////////////////////////
if (form.oRead.checked){
oPerms = 400
}
if (form.oWrite.checked){
oPerms += 200
}
if (form.oExec.checked){
oPerms += 100
}
////////////////////////////////// RWX
if (form.gRead.checked){
gPerms = 40
}
if (form.gWrite.checked){
gPerms += 20
}
if (form.gExec.checked){
gPerms += 10
}
////////////////////////////////// OGA
if (form.aRead.checked){
aPerms = 4
}
if (form.aWrite.checked){
aPerms += 2
}
if (form.aExec.checked){
aPerms += 1
}
form.result.value = perms
form.oResult.value = oPerms
form.gResult.value = gPerms
form.aResult.value = aPerms
}
//stop hiding-->
</script>
|
|||||||||||