1. Cut tofu into 2- by 3-inch, 1/2-inch-thick slices and pat dry.
2. Place sugar in a 10- to 12-inch frying pan over medium-high heat; shake pan often until sugar is melted and amber colored, 2 to 3 minutes. Add 1/2 cup hot water (mixture will bubble vigorously) and stir over medium heat until caramelized sugar is dissolved.
3. Stir in soy sauce, shallots, ginger, and garlic; stir often over high heat until boiling. Lay tofu pieces in a single layer in sauce. Simmer, uncovered, over medium-low heat for about 5 minutes. With a wide spatula, turn pieces over; simmer until hot and coated with sauce, 3 to 4 minutes longer.
4. Transfer tofu and sauce to a serving dish and sprinkle with green onions and pepper.