Yes, you can prevent your CC computers to boot from disks.
But you have to change code within the ROM folder, i.e. you can only change it from outside of Minecraft!
If you're picky about it being ROM (you know, read only and all), then you could look at it like a computer company just producing another series of computers, with a new ROM. ;)/>/>
How do I disable booting from disks?
Spoiler
Go into .minecraft\mods\ComputerCraft\lua\rom\programs\ and open the file "shell".There search for the following code block:
-- Then run the user created startup, from the disks or the root
local sUserStartup = shell.resolveProgram( "/startup" )
for n,sSide in pairs( redstone.getSides() ) do
if disk.isPresent( sSide ) and disk.hasData( sSide ) then
local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), "startup") )
if sDiskStartup then
sUserStartup = sDiskStartup
break
end
end
end
Comment out everything starting from the "for" statement, so that it looks something like this ( I used the multinline comments –[[ and –]] ):
-- Then run the user created startup, from the disks or the root
local sUserStartup = shell.resolveProgram( "/startup" )
--[[
for n,sSide in pairs( redstone.getSides() ) do
if disk.isPresent( sSide ) and disk.hasData( sSide ) then
local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), "startup") )
if sDiskStartup then
sUserStartup = sDiskStartup
break
end
end
end
--]]
Can I limit booting from disk to specific computers only?
Spoiler
Yes, that's possible as well. Every computer who starts up is booting from the same base rom, so you only have to access the computer's ID from the shell program via os.computerID().For example, to allow only the computer with ID# 3 to boot from disks, you could change the code-block from before to this:
-- Then run the user created startup, from the disks or the root
local sUserStartup = shell.resolveProgram( "/startup" )
if os.computerID() == 3 then
for n,sSide in pairs( redstone.getSides() ) do
if disk.isPresent( sSide ) and disk.hasData( sSide ) then
local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), "startup") )
if sDiskStartup then
sUserStartup = sDiskStartup
break
end
end
end
end
Notice how I only added a simple "if os.computerID() == 3 then" and it's respective "end" to the code.You could just as easily allow a certain range of computerID's or even define an arbitrary list in a table and run through that.
For example, if you didn't outright wanted to disable the possibility of booting from disks altogether, but still wanted to limit it, you could rename the "startup" for the disks, to something else that nobody but your "Maintenance-Team" on your server knows about.
It'd then act as some kind of password. But of course only as long as nobody finds out about it by finding a disk with a weird file name on it. ;)/>/>
So this way it isn't secure per se (security through obscurity never is), but it prevents people booting from disks, who only know about the default "startup" file for disks.
But why stop here?
You could just as well insert code that forces users to enter a password if they want to boot from disks.
It's limited pretty much by your own ideas and programming skills.
But please don't go wild and publish dozens of new hardened, secure "OS"s.
Let people do that by themselves and learn something in the process.
(Not that these would be OSs to begin with. If anything you've created a modified shell.)
K, hope this was interesting enough for some, take care! :D/>/>