Kotor is a coastal town in Montenegro.
Walk to the tunnel along the road towards Budva. Vehicles go pretty slow here and there's plenty of space for them to pull over. Some anonymous hitchhiker got a ride to Podgorica in less than an hour. Lifts to Budva are even easier.
Also, if you get a lift through the tunnel, about three hundred meters after the junction to Podgorica/Tivat there is a big petrol station with shopping centre behind. You can easily find a car to Budva and Tivat.
Alternatively, there is a bus stop near the gas station shortly before the tunnel. Jan got a direct ride from there to Cetinje in about half an hour.
Towards Herceg Novi, Dubrovnik
From the old town walk out of the city until you find a good place for cars to stop. You should be able to find a ride to Herceg Novi. From there it might be a bit more difficult to continue to Croatia.
Use the instructions for going to Budva first, most drivers go to Cetinje that way. There is a minor road that goes to Cetinje directly but the traffic there is too sparse to be useful.
There is a perfect wild-camping spot right on the city walls. Enter the old town through the 'sea-gate' and quickly make a left turn and keep on walking. Eventually you find stairs to a big cafe/restaurant on the city wall. Keep walking and find the patch of green next to a church to put up your tent.
You can also wildcamp right on the path up to the castle. Not the official path that you have to pay for €3 during the day, but the path that starts more to the east. Find it by entering the old town through the east gate, and then once inside by taking the stairs at your left hand. You'll get to a little place in front of some houses, and there stairs/path up the mountain start. There are several flat spots to put a tent, and you'll have great views when you wake up. Since people will walk here, you'll have to clear your tent in the morning.
Another option is to sleep in the chapel on the trail to Lovcen National Park, behind the castle. To reach it you need to follow the signs for Mt Lovcen and crawl through the hole about halfway to the top of the castle. The chapel sits between the castle and the mountain. Its always open and no one will bother you there, it's secluded and quiet. However, you might want to get up quite early as there are sometimes hikers passing in the morning.
Morris spent one night sleeping inside the room near the top of the castle but was woken up at 01:00 am by a group of non-english speaking and probably local people entering through the door. They were surprised to find someone up there, and continued further up before coming back down after 10-15 minutes. It's unclear what they were doing or if the castle perhaps serves as some kind of meeting point so it may not be advisable to sleep up there.
Joe pitched up his tent on the waterfront close to Bife Bahis Bar. Actually, this is a quite obvious place, but actually no one cared about. There is a huge ruin of a hotel from the 80ies close by - not nice to sleep, but cool to explore and on the top, there is a terrace where you have an amazing view of the city. There is a cementry about 500m south of the beach front. In the southern edge there is a facility building where you'll find toilets and even a shower, that were unlocked even during the night.
Anna&Bene 2018 . still very nice spot to sleep! We choose the one entering the east gate and then up to the left! Beautiful! There was a big festival and still nobody else except us
[Tom] spent a night here. I scouted the area to the left of the gate and Arms Square, but after gatecrashing a hostel for some beer and company and staying out rather late, he found that the area gets locked. At least a man repeatedly told me 'closed' and going around to the stairs at the back that lead directly to the (slightly) grassy area, I found a locked gate in the way. I instead found a spot just above the old walls at the south end of the town. Left of the southernmost viewpoint area on top of the walls, look for a step up to a path that leads towards more walls and a dusty mud path upwards. It leads to a little plateau with a floodlight for the walls. You could get a tent in there, but in the light. The weather was good for me so just found a place for a sleeping bag. Only interruption was as I unpacked my stuff, a pair of Aussies came and retreated again down the hill for some recreational procreation. The path is also an access to the fortress on the hill that avoids the €8 entrance fee, so a couple of tourists will pass by in the morning.
in the city there are several public tabs to get nice fresh water! To get a shower check out the area with the saltwater pool just before the official beach (coming from the east)