ls -l -d /tmp/ and you will see that the permissions are set to
d: a directory,
rwx: read, write and execute permissions allowed for owner, group and others (in this order),
t sticky bit, i.e. only file owners are allowed to delete files (not the group despite permissions). Let's leave the sticky bit aside for the moment and mention that a directory needs to be executable for being accessible.
Now if you want to restrict write permission for others (owner and group is root) then use
chmod o-w /tmp/ (as root, i.e. using
/tmp/ is rather important for may processes that need temporary data, so I would suggest not to restrict permissions for this folder at all!
Since you are heading for a specific folder the simplest would be to manually create that folder (as root) and then restrict permission for it:
sudo mkdir /tmp/badfolder
sudo chmod -R o-w /tmp/badfolder/
Side note on chmod:
-R do recursively, u,g,o: user,group,other , +- add/remove permission to r,w,x read,write,execute. I.e. for allowing gorup members to write to a file, use
chmod g+w file.
In case the process is running as root, you also need to set the 'i' attribute. From
A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the
CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
This would also apply if the folder was not owned by root. Simply use
chattr +i /tmp/badfolder
chattr -i /tmp/badfolder for removing it and
-R for doing either recursively.